In this document it shows you how to set up the CSV so you can import new products to your Magento 2 store.
1. Creating the CSV.
Your CSV must be UTF-8 format. Therefore it will be preferable to create the CSV in either Google Docs or OpenOffice, both of which provide native UTF-8 compatibility. Do not use Excel to generate the CSV Excel adds formatting that causes issues when importing.
Magento 2 has a certain set of fields that are mandatory these need to be added to the CSV before you can import.
These fields are :-
- SKU
- Store View Code
- Attribute Set
- Product Type
- Product Websites
- Weight
- Product Online
- Tax Class
- Name
- Price
- Quantity
- Description
- Small Description
- Categories
Each of these headings has to use the code version of the attribute name this is usually all lowercase and underscore separated version of the name.
You will find all the correct headings in the attached sample CSV.
SKU - The Value needs to be a unique item code for each product.
Store View Code - The code of each of the store views used if the data is different per store view. Left blank if you want to use the same data for all stores.
Attribute Set - The Value needs to be one of the Attribute sets created in Magento. This is set as Default as standard unless you have created custom attribute sets.
Product Type - This is one of the product types in Magento either Simple, Configurable, Bundle, Grouped, Downloadable, Virtual
Product Website - The value for this column is Base unless you have more than one website, then this is a comma separated list.
Weight - This is the numeric weight value of the product.
Product Online - This is either a value of 1 or 2. 1 = Yes the product is enabled for Sale 2 = No this product is not enabled for sale.
Tax Class - Should be one of the tax classes on the products I.E Taxable Goods
Name - The name of the product
Price - The price of the product
Quantity - The stock quantity of the product this can be 0.
Description - The Description of the product.
Small Description - A smaller description not as in depth as the Description attribute.
Categories - A comma separated list of the paths to the categories you want the product to be in. (See Example in the CSV attached to this article)
2. Optional attributes that have their own heading.
In the CSV there is a list of optional attributes you can import data too that have their own heading.
This is a list of some that you might want to add.
- URL key
- Meta Title
- Meta Keywords
- Meta Description
- Special Price
- Special Price To Date
- Special Price From Date
- Additional Attributes (See Section 3)
3. Importing Additional Attributes.
Additional attributes make up the other attributes that are either custom or do not need main headers.
For Example if I needed to add Size and Colour to a product is would add them under the additional_attributes header on the CSV. You do this by using this syntax you can do more than one attribute you just comma separate the list.
attribute_code=value
If I was to this with the colour attribute in the CSV it would look like this
colour=Blue
For example colour and size would look like this.
colour=Blue,size=UK10
In order for this to map correctly you need to make sure the attribute code matches the one in magento and the option you are adding is an exact match to one of the options in the attribute. This means the spelling has to match unless the attribute is a text field then the value can be what ever you want.
You can find the attribute code and the options available but navigating to Stores > Attributes > Product
In the left hand column you will see the code you need. Clicking into the attribute will allow you to look at the options in the attribute.
4. Importing the CSV
Once you have built the CSV the next step is to import the CSV to Magento.
Navigate to System > Data Transfer > Import
Once in this section select Products from the Entity Type drop down.
Scroll down to the section "Select File to Import" Upload your CSV.
Click check data once the validation has run if you have any errors in the CSV you will be asked to fix these before you can run the import.
If you have no errors you will be met with a button to Import the file.
Click this button and wait for the import to run. Your new products will be waiting for you in the catalog.
Comments
0 comments
Please sign in to leave a comment.