I'm starting a new integration using graphql api and I need to run frequent media updates, but when I use the `media` input field it only appends the new content instead of overwriting the previous one. But in my case I need to actually replace the old ones with new ones.
If I have to delete the old ones before updating then it is 2 extra api calls (one to get old media ids and another one to delete it) but we have the rate limits so I would like to avoid calls like this whenever it is posible.
I'm interesting in a solution for this as well.
I need to do bulk image updates constantly to keep them in sync with correct images, but to first have to download all images, save IDs, then do anther call to delete them is very inefficient and is not going to work for thousands of products.
There isn't even an option to run a productDeleteMedia mutation in a bulk operation.
I also would be interested in a solution or in not deprecating the `images` field on the product and `imageSrc` on the product variants. The `images` field behaviour is ideal for syncing engines, since it allows to always override the existing images.
As far as I know, there's no simple way to manage product medias anymore since the version 2023-07.
As mentioned, the "images" field was perfect as it would allow not only to replace every images with the new ones, but it also allowed us to manage the sort order.
Now, the only solution I see is:
1. Store the medias in the app's database
2. On every sync, detect any creation, update or deletion for each media
3. Call the productDeleteMedia mutation to delete all medias (if need to have a specific sort order, or else only add the deleted medias in the variables)
4. Call the productCreateMedia mutation to recreate every media.
But this is really not optimal as it makes 3 API calls (productUpdate + productDeleteMedia + productCreateMedia) instead of only one (productUpdate), we need to store the medias in the app's database and detect any change etc.
Shopify really needs to improve this new "media" variable to at least manage the creation, update and deletion of medias, and add a sortOrder field too!