When installing a new Magento 2 website or migrating an existing Magento 2 website to another, you may also want to transfer all products on the old site.
You can manually move product 1 by 1 by using the copy-paste method. However, this is only viable for small stores with not too many products. Fortunately, in Magento 2, we can bulk import product using CSV, all you need to do is to fill into the importing template csv file provided by Magento 2.
This tutorial will guide you step by step through the process of bulk import products to Magento 2 using CSV file.
Step 1: Go to Import section in Magento 2 admin section
You can find Import Section in System > Data transfer > Import
In Entity type, select Product to import product
Next, click on Download sample file to download csv template file to bulk import Magento 2 product
Step 2: Prepare CSV file which contains product data
In Import section, you can download a pre-generated CSV file which contains sample placeholder data. In case you can’t download the file, I uploaded a file here, just click to download:
- Download csv template file to import Magento 2 product
Note: If you want to specify thumbnails and small images for product, you need to add these fields to CSV file. For example:
- Base_image: link main product image
- Small_image: link to small product images
- Thumbnail_image: link to thumbnail images
- image label: image titles, you can leave these fields empty
If you want to import multiple images for a single
sku, insert the images in a column named
additional_images (add the column to csv file if does not exist), separated by commas. Example:
In case you import product on a local server, don’t put include the path before the filename in the CSV data if you put image in the default import folder:
Step 3: Specify import options
After preparing the csv file for import, go back to import section in admin.
Now we will set import behavior
There are 3 types of import behavior:
- Add/update: No data will be remove or replace, new product data from csv file will be added to the existing product data (except SKU field)
- Replace: This option will replace new data with existing data if they are the same, old data will be completely removed. The value Magento 2 will look for to determine if the was an existing product is product SKU.
- Delete: Use this option if you want to remove existing data, any data that is existed in the database will be removed.
As we are importing product, we will select Add/Update
Next, we will set Validation Strategy for the import process
- Stop on Error: If you want the import process to be stopped when there’re error during the process
- Skip error entries: The system will skip any errors found during import and continue the import process.
Allow error counts defines the number of errors to stop import process. Set 1 if you want to stop the import process right after the 1st spotted error.
Field separator define the type of field separtor in your csv file, leave it default if you want to use “,”
Multiple value separator define the type of field separtor in your csv file, leave it default if you want to use “,” (for example:
product_image_1.jpg,product_image_02.jpg). Make sure to set this matching with the separator character you use in CSV file to avoid error.
Step 4: Upload csv import file and start import process
The last field is
If you upload images to
/var/import/images then input
/var/import/images in this field
Next, click on browse and select your prepared csv file.
Finally, click on Check Data button to start validating import data. If the csv file has correct setup, the following message will be displayed:
File is valid! To start import process press “import” button
Import Magento 2 product using CSV video tutorial
In case you find it hard to follow steps in this tutorial, please watch this video to learn to how bulk import product in Magento 2 using CSV file.
Most common import issues
There may be some issues during the import process, I will list out all the issue I encountered and solution for each.
Please make sure attribute (price/shipment_type) is not empty. in row(s): 4
Solution: Check the row as in suggestion and fill in the desired value
Value for ‘msrp_display_actual_price_type’ attribute contains incorrect value, see acceptable values on settings specified for Admin in row(s):1
Solution:Go to Stores -> Attributes -> Product and look for the values of the product attribute. Correct these values with the ones specified in CSV file
Curly quotes use instead of straight quotes in row(s).jpg
Solution: This error happens due to wrong separator format in CSV file. Check the separators and double quotes in the CSV file and add the missing values
Url key for specifed store already exists
Solution: This error happens because there was a product in your web site having the same URL key as the product in csv file. To fix this add some extra characters to the product URL in csv file.
Product type is Invalid or not supported
Solution: Check if product type is set correctly in CSV file, the product type value should be one of the following: Simple/Configurable/Grouped/Downloadable
Value for visibility attribute contains incorrect value
Solution: The visibility attribute is not valid. The valid values in Magento 2 are:
- 1: Not Visible Individually
- 2: Catalog
- 3: Search
- 4: Catalog, Search
Store doesn’t exist
Solution: Check if store is available, if not create a new store that matches the value in csv file
Cant find required columns
Solution: The column is missing, go to your csv file and add the required column.
The process of importing Magento 2 product is very complicated if you have never done it before. After some successful attempts, you will be familiar with the import process. If you have any problems during the import process, please leave a comment below. I will try my best to help you.
In the next article, I will guide you on how to import configurable products, a more complicated process. Stay updated!