Magento 2.1 Import – Replace Product Images via CSV Import

importmagento-2.1product-images

I'm following this tutorial http://docs.magento.com/m2/ce/user_guide/system/data-import-product-images.html to upload and assign images to product.
I have successfully completed this process but i want to replace exiting images with new images. To replace images following CSV header is used to update images

sku store_view_code attribute_set_code  product_type  base_image  base_image_label  small_image small_image_label thumbnail_image thumbnail_image_label 

But problem is instead of replacing images, Magento2 import process adds new image with old image.

(Similar issue with category update : https://github.com/magento/magento2/issues/7930)

Best Answer

Like @carsen.eldon mentioned, Magento does not do that. It works similarly with categories. I think that's why the replace import functionality might have been "invented".

In order for Magento to know whether to leave the images alone, or to update it, it would need to keep track of image metadata — I.e. a hash of the file, or the filesize in bytes, or some sort of metadata (exif) inside the actual image file.

I do strongly think that CSV import should be idempotent and declarative. As it stands now, importing the same file twice causes side effects.

There's a bugreport for it here: https://github.com/magento/magento2/issues/14398

Magento's import is quite lacking in many respects.

Edit: I've added my PR here: https://github.com/magento/magento2/pull/21146

Related Topic