I can’t update product media and associate them with the variants in productUpdate mutation. When I do that, the media gets created but not associated with the variants. When I try the same payoload for creating the product it works just fine.
Also, it works fine with old images and imageSrc
The mutation I’m trying is something like this:
QUERY
mutation productUpdate($input: ProductInput!, $media: [CreateMediaInput!]) {
productUpdate(input: $input, media: $media) {
product {
id
}
}
}
VARIABLES
{
"input": {
...
"id": "gid://shopify/Product/123456"
"options": ["size", "color"],
"variants": [
{
...
"options": ["S", "RED"],
"mediaSrc": ["https://image-1-url"]
},
{
...
"options": ["M", "RED"],
"mediaSrc": ["https://image-1-url"]
},
{
...
"options": ["S", "GREEN"],
"mediaSrc": ["https://image-2-url"]
},
{
...
"options": ["M", "GREEN"],
"mediaSrc": ["https://image-2-url"]
},
{
...
"options": ["S", "BLUE"],
"mediaSrc": ["https://image-3-url"]
}
{
...
"options": ["M", "BLUE"],
"mediaSrc": ["https://image-3-url"]
}
]
},
"media": [
{
"originalSource": "https://image-1-url",
"mediaContentType": "IMAGE"
},
{
"originalSource": "https://image-2-url",
"mediaContentType": "IMAGE"
},
{
"originalSource": "https://image-3-url",
"mediaContentType": "IMAGE"
},
{
"originalSource": "https://image-4-url",
"mediaContentType": "IMAGE"
},
{
"originalSource": "https://image-5-url",
"mediaContentType": "IMAGE"
}
]
}