Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
Hi all,
I am trying to retrieve metafield from products and productVariants, here I have an example query:
{
productVariants(first: 10) {
edges {
node {
id
metafield(namespace: "namespace", key: "key"){
value
}
}
}
}
}
But what should key and namespace be? Because, now it just retrieves "null"
Can't seem to figure it out. In the data for variants I can see metafields for a specific variant that has for example:
Color group: Blue
Petrol color code: 5812
I want to retrieve all these fields, how can I best do that?
Hi WollyMeister,
Are you trying to receive all the metafields on products or just specific ones? There's examples of namespaces and keys in our dev docs here.
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog