Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
I am looking at using the New MediaImge (replacing image). I can add the image no problem but I want to add metafields to the image.
I can sue metafieldsSet to add metadata
{ "metafields": [ { "key": "zexample", "namespace": "hcp", "ownerId": "gid://shopify/MediaImage/25277232775256", "type": "string", "value": "my value" }, { "key": "example", "namespace": "hc-defined", "ownerId": "gid://shopify/Product/7359008473176", "type": "string", "value": "my value" } ] }
query productByHandle ($handle: String!){ productByHandle(handle: $handle){ id title handle media(first:10){ edges { node{ id alt status mediaContentType preview { image { altText id metafield(key: "zexample",namespace: "hcp") { namespace key value id } metafields(first: 20) { edges { node { id key value } } } } } } } } images(first:10){ edges { node { src id altText src metafields(first: 10) { edges { node { id key value namespace } } } } } } } }
{ "node": { "id": "gid://shopify/MediaImage/25277232775256", "alt": "hello grant.", "status": "READY", "mediaContentType": "IMAGE", "preview": { "image": { "altText": "hello grant.", "id": "gid://shopify/ImageSource/25283307602008", "metafield": null, "metafields": { "edges": [] } } } } }
Can anyone tell me what I am missing?
Thanks