Import product images using CSV in Magento 2 (Attached example CSV)

import-product-images-magento-2

Magento 2 out of box support importing products, pricing, customer, and customer address. However, many vendors don’t know that they can also import product images using CSV in Magento 2 as a product’s import.

When you should import images using CSV?

There are many scenarios in which you need to import product images using CSV. Here, I’m listing a few scenarios.

  1. When you rebranding your website and would like to change the product images in bulk.
  2. When you do migration from Magento 1 to Magento 2 and you do not want to keep Magento 1 images.
  3. When you migrate data from another eCommerce website to Magento 2 and you want to add product images in bulk.

We will see step by step on how to import product images using CSV in Magento 2. Please note that all products must be created in Magento 2 before importing images using CSV.

Import products images using CSV

  1. Create CSV file named import_images.csv using UTF-8 encoding supported editor such as Notepad++, Sublime text or OpenOffice Calc
  2. Edit that CSV and add below columns in it.
    • sku: Product SKU
    • base_image: The main image you will see on the product page
    • base_image_label
    • small_image: The image you will see on the product listing page, search result, homepage etc.
    • small_image_label
    • thumbnail_image: The image you will see in the shopping cart
    • thumbnail_image_label
    • additional_images: These images you will see on product page in the slider gallery.
    • additional_images_label
  3. Add images name in each column. If you do not want to upload a particular type of image for a product then you can keep that column blank.

    There are two more columns named swatch_image and swatch_image_label you can add them to your CSV if you want to upload swatch images. These images are displayed on the product page as a selection.

    Import products images using CSV

  4. Once you filled up all details in CSV, it is ready for import. But before you import it, make sure to upload all the real images of products on Magento 2 server under var/import/images directory. This is the default directory read by Magento 2 while importing images. If you upload images in another directory, then you have to mention them in the import config.
  5. Go To Magento 2 Admin > System > Data Transfer > Import.
  6. Under Import Settings, Select Entity Type Products.
  7. Under Import Behavior, Select Add/Update.
  8. Keep all other fields value as it is.
  9. Click Choose File to select the file which we have prepared in above steps.
  10. In the Images File Directory field, you need to mentioned the relative path to the location of directory where images are stored. Keep it blank if your images are stored under var/import/images directory.
  11. Click Check Data from upper-right corner. It will validate the CSV data.
  12. If the CSV file is valid, click Import. If there is any error then correct it and re-import the CSV. When import finished you will see the success or failure message.
  13. Go to Admin > System > Cache Management and flush the cache.

Notes: Make sure you delete the previous images from the product before you import the CSV. Otherwise, you will see both old and new images on the product.

Conclusion

Using Magento 2 Import feature, we can easily upload the product images in one go. If you are getting errors while importing, Download Sample CSV and try it. Feel free to add your queries in the comment box below.

Want to ask a question or leave a comment?

Leave a Comment

(0 Comments)

All the comments are goes into moderation before approval. Irrelevant comment with links directly goes to spam. Your email address will not be published.

Was this post helpful? Please support Us!

Follow us on twitter or Like us on facebook.

 


Subscribe Here
SUBSCRIBE NOW

Want to Increase your Magento 2 Development Knowledge?

If Yes! Then Subscribe to our newsletter and receive step-by-step tutorials, code snippets once a week!!
close-link

To Avoid Spam Downloads, We Want Your Email

We will send you download link right
away. Please submit form below.
SEND ME DOWNLOAD LINK
Close