How to retrieve metafield from products and productvariants

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.