Discuss all the new features introduced with the new product model in GraphQL.
I have 3 images in a product created with the REST product creation, and I want to update the "alt" property images with the productUpdateMedia mutation, but it doesn't work. Following the request and the response:
note the "media : null" in the response.
Curiously, if I try to use the productCreateMedia the operation work fine:
Then I tried to update, with the productUpdateMedia mutation, this new image created with productCreateMedia, and the operation still doesn't work.
Have you any idea to solve this problem?
Thank you.
Solved! Go to the solution
This is an accepted solution.
It was simple.....
The image id variable is a ProductImage id, not a MediaImage id. It's not possible get the number of the ProductImage and build the MediaImage.
Example
if the image id is 0123456789 I can build the gid product image in this way:
gid://shopify/ProductImage/0123456789
but if I need to refer to the media image I cannot build it like:
gid://shopify/MediaImage/0123456789
The media image will be different, to discover it it is necessary query the product and catch it, like something of the following:
the id hightlighted in red is the MediaImage, this is to be used for productUpdateMedia mutation.
This is an accepted solution.
It was simple.....
The image id variable is a ProductImage id, not a MediaImage id. It's not possible get the number of the ProductImage and build the MediaImage.
Example
if the image id is 0123456789 I can build the gid product image in this way:
gid://shopify/ProductImage/0123456789
but if I need to refer to the media image I cannot build it like:
gid://shopify/MediaImage/0123456789
The media image will be different, to discover it it is necessary query the product and catch it, like something of the following:
the id hightlighted in red is the MediaImage, this is to be used for productUpdateMedia mutation.