Discuss all the new features introduced with the new product model in GraphQL.
I used the `productCreate` and `productVariantsBulkCreate` mutation to create the product and its variants. Is there a mutation available to update the default product image? I looked up the `productUpdate` mutation and couldn't find a property that can help me acheive this. Any advice on how I can do this?
Solved! Go to the solution
This is an accepted solution.
Thanks for posting your question. The productReorderMedia mutation serves this purpose. Once a media on a product is set to the 0th position, its the default product image.
mutation ReorderProductMedia {
productReorderMedia(
id: PRODUCT_GID,
moves: [
{
id: MEDIA_ID, # ID of the image you want to set as default
newPosition: 0
}
]
) {...response fields...}
}
Please let us know if you run into any issues using this approach.
This is an accepted solution.
Thanks for posting your question. The productReorderMedia mutation serves this purpose. Once a media on a product is set to the 0th position, its the default product image.
mutation ReorderProductMedia {
productReorderMedia(
id: PRODUCT_GID,
moves: [
{
id: MEDIA_ID, # ID of the image you want to set as default
newPosition: 0
}
]
) {...response fields...}
}
Please let us know if you run into any issues using this approach.
Is it enough if I just set the newPosition of just one element or do I need to change the positioning of all the other images on the product as well?
Just adjust the product images you need, the other images will be automatically arranged