Replace variant images on PUT /api/variants/{id}



I have successfully added a variant to arcticle and uploaded a picture to added variant.


Now I want to update this images using PUT /api/variants/{id} and „__options_images: {replace: true}“ in the body. But it always add a new picture to already existing one. And instead of having 1 picture there 1 new and 1 old. 


How can I achieve replacement of the image without sending imageId?


Thank you.


I think you have 1 new and 1 old but just the new one related to the variant and the old one related to the main article .

the option ‘__options_images’ hier is to replace the image mapping and not to remove the old image from the article, and you can send your request without this option because the default logic by variantes => images is replacing the image mapping.

if you use the imageid the code will search for this id in the article images if it there then it will used it if not it will search in the all media and add the image to the article then map it to the variant.

if you use the image link the code will always add a new image to the article but it will mapping the new image to the variant.

I think the logic hier, that maybe the old vaiant image mapped to another variant so remove it from the article will make a problem.

the only way to replace the alle images using the api is sending them all to the /api/article with a neu assigment, but this will create a new images every time you want to change somthing.

or you can  extend the variants Endpoint to match you requierments.



Tel.: +49 755 - 183 990 00 | E-Mail: | Web: