How can I set a product metafield to be a file reference (image) using graphQL?

den232
Shopify Partner
143 5 43

How to get from here to there?

 

I have a few images that I need to attach to a product but not be visible as product image.   I would like to use a metafield with the type file_reference.  I see how to read it out, but not how to set it.  As I understand, I need the mediaImage id to set its value.   I can do a staged upload but how do I get from there to a gid for the image?

 

It should be going into something like this ...

 

Thanks! and best regards jb

 

metafield(namespace: "xxx", key: "yyy") {
   reference {
     ... on MediaImage {
       image {
       originalSrc
       }
     }
  }
}

 

 

Replies 0 (0)