Import product images using CSV in Magento 2 (Attached example CSV)
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.
- When you rebranding your website and would like to change the product images in bulk.
- When you do migration from Magento 1 to Magento 2 and you do not want to keep Magento 1 images.
- 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
- Create CSV file named
import_images.csvusing UTF-8 encoding supported editor such as Notepad++, Sublime text or OpenOffice Calc
- Edit that CSV and add below columns in it.
- sku: Product SKU
- base_image: The main image you will see on the product page
- small_image: The image you will see on the product listing page, search result, homepage etc.
- thumbnail_image: The image you will see in the shopping cart
- additional_images: These images you will see on product page in the slider gallery.
- 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/imagesdirectory. 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.
- Go To Magento 2 Admin > System > Data Transfer > Import.
- Under Import Settings, Select Entity Type Products.
- Under Import Behavior, Select Add/Update.
- Keep all other fields value as it is.
- Click Choose File to select the file which we have prepared in above steps.
- 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
- Click Check Data from upper-right corner. It will validate the CSV data.
- 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.
- Go to Admin > System > Cache Management and flush the cache.
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.
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.
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.