A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
I've been working for a private app and i found myself needing to update the product from an external app and thus to reflect the changes of the product in the Shopify store. For this i use productUpdate mutation, this is my code;
mutation{
productUpdate(input:{
id: "gid://shopify/Product/7177251913918",
productType: ""
descriptionHtml: ""
tags:""
images:{
src: "https://image.shutterstock.com/image-photo/black-large-heavy-thick-metal-600w-1081705028.jpg"
}
variants: [{
price:"20"
compareAtPrice: "500"
barcode:""
inventoryManagement:SHOPIFY
}]
}
){
product{
id
images(first: 2) {
edges {
node {
url
}
}
}
}
}
}
With this i am able to update the title, description of the product, the variant of the product with another price, compare_price, Sku and so on, but using images just deletes my existing images from the product.
I don't want to use the productImageUpdate mutation because we don't store the image id in our db and this would lead to several changes in our code. Is there something wrong with using Images field in productUpdate ?
productUpdateMedia might do it for you ... you do need the (old) mediaIds to replace ... jb