Product media gets deleted if productSet called for a 2nd time

Hi All - anyone got this issue below? If yes, solution?

Call the productSet mutation with “synchronous”: true and with the “files” list in the request. It works file. Product with the media is saved.

Call the productSet mutation again with same request, the existing media files are cleared/deleted and not replaced.

This can be reproduced by repeatedly calling the productSet with the same request. On each 2nd call, the files is getting deleted from the products.

Any help here?

This is expected behaviour if you haven’t supplied the media in your second call. As per the API documentation using productSet is a upsert mutation. If you do not provide the values for the existing files it will remove them.

productSet - GraphQL Admin.

Depending on what you need to update, you might want to consider the more specific productUpdate or one of the media or variant methods :slight_smile: