The built-in import feature in Magento can often be frustrating due to its complexity and less than forgiving nature. In Magento 1, many extensions were created to aid in importing products quickly and easily. With the recent release of Magento 2, there are not many extensions to help with importing products. Documentation is also sparse when it comes to various methods of importing products.
Importing simple type products in Magento 2 isn’t that difficult. You can export a simple product under: System -> Export
and then look at the format. For configurable products (products that have ordering options like size, color, etc… where a number of simple products are attached to a main configurable product), the import process is much more complicated. You can export a configurable product with its associated simple products, but it may not be obvious what is required to have a successful import.
Here are the steps needed to successfully import configurable products (with associated simple products) into Magento 2:
Before you perform an import, the following items should be completed beforehand:
Product attributes should already be created and defined properly. (Stores -> Attributes -> Products)
The product attributes you plan to import should be assigned to an attribute set. (Stores -> Attributes -> Attribute Set)
The category/categories these products will go into should already be set up. (Products -> Categories)
None of the simple products or configurable products should exist in the catalog before importing.
The CSV import file
Magento accepts a valid Comma Separated Value (CSV) text file for import. The file should, by default, use a comma as the field and multiple value separator. You can change these during the import options being selected in the admin panel, but it may cause issues.
There are 5 items you have to take into account when creating the CSV file:
All simple products should be listed before the configurable product in the CSV file. This is required.
The “attribute_set_code” field should match the Attribute Set that contains the attributes for each product.
The “configurable_variations” field should be a pipe separated set of SKU/option combinations for each simple, and be populated only for the configurable product.
The “configurable_variation_labels” field should correlate the Attribute code to the Label Name, and be populated only for the configurable product.
The “additional_attributes” field should list the options for each simple product (comma separated if more than one attribute per simple product).
Example Configurable Product
We’ll look at a basic configurable product as an example: a T-shirt that comes in two colors: Black and Red
In this example, we assume the Product Attribute “color” exists and has defined colors that include Black and Red. We also assume the Color attribute exists in the “Default” Attribute Set. We set the category for the products to “Default Category/Gear/Bags” as an example category.
Here is an example CSV file to import these 3 products (2 simple products and the configurable product):
shirt-black,,Default,simple,Default Category/Gear/Bags,base,T-Shirt - Black,,,1,1,Taxable Goods,Not Visible Individually,1,,,,,,,,,,,,,,,,1/23/2016 19:45,1/23/2016 19:45,,,Block after Info Column,,,,,,,,,,,,,color=Black,5,0,1,0,0,1,1,1,0,1,1,,1,0,0,1,1,0,0,0,1,,,,,,,,,,,,,,
shirt-red,,Default,simple,Default Category/Gear/Bags,base,T-Shirt - Red,,,1,1,Taxable Goods,Not Visible Individually,1,,,,,,,,,,,,,,,,1/23/2016 19:45,1/23/2016 19:45,,,Block after Info Column,,,,,,,,,,,,,color=Red,5,0,1,0,0,1,1,1,0,1,1,,1,0,0,1,1,0,0,0,1,,,,,,,,,,,,,,
shirt,,Default,configurable,Default Category/Gear/Bags,base,T-Shirt,,,1,1,Taxable Goods,"Catalog, Search",,,,,,,,,,,,,,,,,1/23/2016 19:45,1/23/2016 19:45,,,Block after Info Column,,,,,,,,,,,,,size=55 cm,0,0,1,0,0,1,1,1,0,1,1,,1,1,1,1,1,0,0,0,1,,,,,,,,,,,,"sku=shirt-black,color=Black|sku=shirt-red,color=Red",color=Color,
additional_attributes: For the Black T-shirt: color=Black For the Red T-shirt: color=Red
configurable_variations: For the configurable T-shirt product: “sku=shirt-black,color=Black|sku=shirt-red,color=Red”
configurable_variation_labels: For the configurable T-shirt product: color=Color
The import process
Once you have your import file built, you may import it in the admin panel under: System -> Import
Default options for the import should look like:
Then you can click “Check Data” in the upper right of the screen. This should complete fairly quickly. If it hangs up for a very long time, it’s very likely your import file either has bad header options or is not a properly formatted CSV file.
If the check passes, you may click the “Import” button at the bottom to perform the import. Once it is complete, you should go edit one of the configurable products and make sure that on the bottom of the edit product screen, the list of expected simple products are present in the Configurations section:
If you do not see a list of associated simple products, your import file likely had bad data or formatting in the “configurable_variations” field for the configurable product.
As you can see from the details above, importing configurable products into Magento 2 requires many steps and proper configuration before-hand. If you follow the guidelines above, you should be able to successfully import configurable products into Magento using the native Import function.
Zeen is a next generation WordPress theme. It’s powerful, beautifully designed and comes with everything you need to engage your visitors and increase conversions.