I’m experiencing strange behavior when executing the ProductSet mutation with the request provided below multiple times. When I run the ProductSet mutation with the exact same ProductSetInput for the second time, the image is not updated with the same Filename as expected. Instead, the image is deleted, causing it to disappear from the Shopify product page. When I execute the ProductSet mutation again (third time), the image is reattached, but it displays incorrectly, as shown in the attached image. Is the behavior different from that of the fileCreate mutation?
Here are my questions:
- Why is the image being deleted?
- What is wrong with the Input in the request, and is there a way to improve it?
- If this is a bug, what is a temporary workaround?
Below is the actual mutation request and variables used:
(The URL in originalSource is public, so you can use it as is.)
mutation ShopifyProductSet($identifier: ProductSetIdentifiers, $product: ProductSetInput!) {
productSet(identifier: $identifier input: $product, synchronous: true) {
product {
title
media(first: 10) {
nodes {
id
mediaContentType
alt
preview {
image {
id
}
}
}
}
}
userErrors {
message
}
}
}
variable
{
"identifier": {
"customId": {
"namespace": "custom",
"key": "id",
"value": "1234567"
}
},
"product": {
"title": "Nike Running Shoess",
"files": [
{
"alt": "Image",
"contentType": "IMAGE",
"duplicateResolutionMode": "REPLACE",
"filename": "nike_running_shoess.png",
"originalSource": "https://storage.googleapis.com/tmp-dev-sq-file-storeage/image/e7b5e1dc-cb5e-4966-adf8-152b2fb132be.png"
}
],
"metafields": [
{
"namespace": "custom",
"key": "id",
"value": "1234567"
}
]
}
}
The product image processed with ProductSet using the same Input 3 or 4 times