How to retrieve metafield from products and productvariants

4 0 0

Hi all,


I am trying to retrieve metafield from products and productVariants, here I have an example query:



  productVariants(first: 10) { 
    edges { 
      node {
        metafield(namespace: "namespace", key: "key"){





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?

Reply 1 (1)

Shopify Staff
2723 289 741

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 or the Shopify Web Design and Development Blog