Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Now I want to get multiple matafields from Shopify Storefront API GraphQL at the same time.
I'm trying to get data using the following GraphQL, but it seems I can't get multiple metafields at the same time.
{ products(first: 10) { edges { node { metafields(identifiers: {namespace: "pre-purchase", key: "*"}) { id } } } } }
Because my product has the following data.
namespace: pre-purchase, key: flag, value: 1
namespace: pre-purchase, key: start_at, value: 2022/01/01
namespace: pre-purchase, key: end_at, value: 2023/01/01
How can I get above metafield data at one time??
Solved! Go to the solution
This is an accepted solution.
Try this namespace lcpsgo
{ | |
"product": { | |
"metafields": [{ | |
"namespace": "your_namespace", | |
"key": "your_key", | |
"value": "your_value", | |
"value_type": "string" | |
}, | |
{ | |
"namespace": "your_namespace", | |
"key": "your_key", | |
"value": "your_value", | |
"value_type": "string" | |
}, |
This is an accepted solution.
product": { | |
"metafields": [{ | |
"namespace": "your_namespace", | |
"key": "your_key", | |
"value": "your_value", | |
"value_type": "string" | |
}, | |
{ | |
"namespace": "your_namespace", | |
"key": "your_key", | |
"value": "your_value", | |
"value_type": "string" | |
}, |
This is an accepted solution.
Try this namespace lcpsgo
{ | |
"product": { | |
"metafields": [{ | |
"namespace": "your_namespace", | |
"key": "your_key", | |
"value": "your_value", | |
"value_type": "string" | |
}, | |
{ | |
"namespace": "your_namespace", | |
"key": "your_key", | |
"value": "your_value", | |
"value_type": "string" | |
}, |
This is an accepted solution.
product": { | |
"metafields": [{ | |
"namespace": "your_namespace", | |
"key": "your_key", | |
"value": "your_value", | |
"value_type": "string" | |
}, | |
{ | |
"namespace": "your_namespace", | |
"key": "your_key", | |
"value": "your_value", | |
"value_type": "string" | |
}, |
I've tried the following query, then problems was solved.
metafields(identifiers:
[
{namespace: "hogehoge", key: "key"},
{namespace: "hogehoge", key: "flag"},
{namespace: "hogehoge", key: "start_at"},
{namespace: "hogehoge", key: "end_at"}
]) {
value
key
namespace
}
Thank you for your support!
Thanks! It seems problem was solved!!
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025