Magento 2 – Import Configurable Products

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:

Prerequisites

Before you perform an import, the following items should be completed beforehand:

  1. Product attributes should already be created and defined properly. (Stores -> Attributes -> Products)
  2. The product attributes you plan to import should be assigned to an attribute set. (Stores -> Attributes -> Attribute Set)
  3. The category / categories these products will go into should already be set up. (Products -> Categories)
  4. Non 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:

  1. All simple products should be listed before the configurable product in the CSV file. This is required.
  2. The “attribute_set_code” field should match the Attribute Set that contains the attributes for each product.
  3. 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.
  4. The “configurable_variation_labels” field should correlate the Attribute code to the Label Name, and be populated only for the configurable product.
  5. 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):

sku,store_view_code,attribute_set_code,product_type,categories,product_websites,name,description,short_description,weight,product_online,tax_class_name,visibility,price,special_price,special_price_from_date,special_price_to_date,url_key,meta_title,meta_keywords,meta_description,base_image,base_image_label,small_image,small_image_label,thumbnail_image,thumbnail_image_label,swatch_image,swatch_image_label,created_at,updated_at,new_from_date,new_to_date,display_product_options_in,map_price,msrp_price,map_enabled,gift_message_available,custom_design,custom_design_from,custom_design_to,custom_layout_update,page_layout,product_options_container,msrp_display_actual_price_type,country_of_manufacture,additional_attributes,qty,out_of_stock_qty,use_config_min_qty,is_qty_decimal,allow_backorders,use_config_backorders,min_cart_qty,use_config_min_sale_qty,max_cart_qty,use_config_max_sale_qty,is_in_stock,notify_on_stock_below,use_config_notify_stock_qty,manage_stock,use_config_manage_stock,use_config_qty_increments,qty_increments,use_config_enable_qty_inc,enable_qty_increments,is_decimal_divided,website_id,related_skus,crosssell_skus,upsell_skus,additional_images,additional_image_labels,hide_from_product_page,bundle_price_type,bundle_sku_type,bundle_price_view,bundle_weight_type,bundle_values,configurable_variations,configurable_variation_labels,associated_skus
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,

You may also download the sample CSV file.

Key fields include:

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:

Import options (click image to enlarge)

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:

List of simple products (click to enlarge)

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.

Summary

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.

Looking for a web host that understands ecommerce and business hosting?
Check us out today!

34 Comments

  1. Pedro says:

    Greetings Robert,

    I am stuck with the magento 2 import, I am trying with your file (using | as separator or else I get “Attribute with this code is not super in rows”) but I cant get the simple products to associate with the configurable ones.

    I am trying in a Magento 2.0.2 completely new installation, and Ive also tried with an export of a file created in the magento admin.

    Did you get it working

    • Yes, we got it working in a number of different scenarios. Make sure none of the simple or configurable exist beforehand. We kept field and value separator as a comma, which worked in a 2.0.2 store.

    • Alex Ryall says:

      I have managed to upload my own configurable products after encountering these same problems. Changing to “|” instead of “,” is only tricking it into working, the separator should be a “,” and the “Attribute with this code is not super in rows” error message is because the attributes in the spreadsheet do not match the attributes that have been setup in Magento.

  2. nepal says:

    How to import a product to multiple categories.More than 4 categories? Is there any limit ?

  3. melb says:

    Thanks for the article. Is there any workaround for importing a configurable product and associating it with simple products that already exist?

  4. antoine says:

    Hi Robert,
    Do you offer consulting service. Since 24hours, we are stuck. I tried to follow exactly your csv and your process and we still have issues.
    Yes the import is done properly,
    the simple products are upload into magento,
    same for the configurable products,
    the image too

    but at the end, We still need to go back into the backoffice, edit the Master products and click on edit configurable to generate link between the master and options. ( configurable_variations + configurable_variation_labels = have been done correctly also)

    Please let me know if I can send you an email with the file

    Thanks
    Antoine

  5. lee says:

    Hi – Im pulling my hair out with this. The 3 products import .. its just that the simple products are not associated with the configurable. I can manually create config products without any issue. One thing – Im using a mac. could the csv file type cause an issue?

    Any pointers appreciated

    • I just tried this on a new 2.1.0 Magento store with the sample csv from the post. Still works. Make sure none of the products exist, and that your import file lists all the simple products first, with the configurable product last.

      After import, click on the configurable, and scroll to the bottom of the edit screen. It should list the variations with all of the simples attached.

  6. lee says:

    thanks for your reply. yeah – i can get your vanilla file to work if i dont edit it. i will keep experimenting to find out why my own live products dont work. i suspect its something lame like the attribute case string needing to match. i had the colours in lower case in my own file.

    thanks again for reconfirming.

  7. lee addy says:

    Robert. It did turn out to be a case issue. One thing you might be able to shed some light on.

    If your t shirt had 2 sizes ( 55cm and 66cm and two more simple rows were made )

    would the configurable_variations field be something like this?

    sku=shirt-black-55,color=Black,size=55 cm|sku=shirt-red-55,color=Red,size=55cm|sku=shirt-black-66,color=Black,size=66cm|sku=shirt-red-66,color=Red,size=66cm

    thanks

    lee

  8. lee addy says:

    thanks – i have it working.

  9. Jesse Maier says:

    I have a question regarding the configurable_variations field…

    When I export my configurable products, I get something like the sample above for the configurable_variations field:
    “sku=shirt-black,color=Black|sku=shirt-red,color=Red”

    However, if it is CSV (comma separated) for multiple values, then the above is separating between “black,color” and “red,color” instead of “Black|sku”, correct?

    Could this be why people are having problems with the configurable_variations?

    The multiple value separator has to be a “|” for this to import properly, correct?

  10. Robert says:

    Default built-in magento import works for me, almost. It adds the simple and configurable products into Magento, but when I go to edit configurable product, I get errors. I would just like to add another good friendly paid module because it saved me hours. If anyone wants a solution that imports configurable and grouped products, try Store Manager: http://www.mag-manager.com/free-download

  11. Alex says:

    Not sure if you anyone else has come across this issue or if i’m misunderstanding the functionality of magento (pretty sure I’m not) but after successfully importing the csv into magento, if I then try and add an image or update the content of the configurable product (i.e. its description) then all the simple products linked to the configurable product get delinked and the configurable product becomes a simple product again.

    This does not happen when i create a configurable product directly in the back end of magento and then update it.

    Is there anything in the CSV that might cause this?

    Thanks

  12. JaY says:

    It works of import with one config option ie color here but it does not work import of configurable with color and size. Can you please give demo file with color and size?

    My version: 2.1.2

  13. Farooq says:

    Hi,
    Thanks for the article. Really helped me.

    I also wanted to ask you how I can upload multiple images for the same product.

    Can you please upload a sample CSV?

    Best,

  14. Michael says:

    Hello,
    thanks for your fantastic approach and tutorial

    does anyone try to import the test csv file into magento 2.1.6?

    I run the import after adding color black and red, import success

    but it doesn’t link simple products to configurable products.

    Should i try to downgrade?
    best regards

  15. Vik says:

    It works for me in 2.1.6.

    Check everything matches up as described in the article and you should be good.

    I did have a problem with images however, they were importing into the backend ok, but not displaying in the front end properly i.e. missing catalog images and missing configurable images.

    To resolve this I split the import into 2, the first one with only simple products, then a 2nd with only configurable products.

    • Vik says:

      Actually the problem with images in the end I found was something else.

      I had to run magento catalog:images:resize; after as for some reason during the import they are not all created!

      There is also another bug where no more than 500 products appear, apparently this will be fixed in 2.1.7!

  16. Cudo says:

    I could not associate the simple products to the configurable product during import and notice something when exporting products that already worked in Magento 2:

    1. I make sure all fields are delimited with quotation marks: ”
    2. in additional_attributes the value should be in quotation marks. That means “size=S” becomes “size=””S”””. Double quotation marks tells the system that the second quotation mark following the first is not a delimiter.
    3. Be sure to save the file in UTF-8
    4. It is often best to check in a plain text editor that it looks right, Excel might do weird stuff you don’t see.

    This is tested on Magento 2.1.6

  17. Laércio says:

    Hi Rob,

    Your article is perfect! It solved all my problems. Works fine for me.

    Thank you!

    Congratulations!

  18. trewq says:

    Hi,

    why
    1st.) exporting a file (MG 2.1.5) with 10 products 2sec
    2nd.) importing that file takes 10000000… sec

    lasts forever ?¿

    Cheers,

    Have a nice day

  19. Yisroel Kraus says:

    im having a issue importing products with multiple attributes I have waisted hours already can any body help me?
    everything is importing the only issue is that nothing gets associate
    here is the configurable
    K2,default,Default,configurable,Default Category/Robes/Kids,base,eyelet robe,,,,1,Taxable Goods,”Catalog, Search”,74,,,,,,,,,,,,,,,,,,,,Block after Info Column,,,,Use config,,,,,is_best_seller=No,,,1,0,0,1,1,1,10000,1,1,1,1,1,1,1,1,1,0,0,0,,,,,,,,,,,,,,,,”sku=K2-PINK3,color=hot_pink,prod_size=3|sku=K2-PINK4,color=hot_pink,prod_size=4|sku=K2-PINK5,color=hot_pink,prod_size=5|sku=K2-PINK6,color=hot_pink,prod_size=6|sku=K2-PINK7,color=hot_pink,prod_size=7|sku=K2-PINK8,color=hot_pink,prod_size=8|sku=K2-PINK10,color=hot_pink,prod_size=10|sku=K2-PINK12,color=hot_pink,prod_size=12|sku=K2-PINK14,color=hot_pink,prod_size=14|sku=K2-BLUE3,color=royal_blue,prod_size=3|sku=K2-BLUE4,color=royal_blue,prod_size=4|sku=K2-BLUE5,color=royal_blue,prod_size=5|sku=K2-BLUE6,color=royal_blue,prod_size=6|sku=K2-BLUE7,color=royal_blue,prod_size=7|sku=K2-BLUE8,color=royal_blue,prod_size=8|sku=K2-BLUE10,color=royal_blue,prod_size=10|sku=K2-BLUE12,color=royal_blue,prod_size=12|sku=K2-BLUE14,color=royal_blue,prod_size=14|sku=K2-NAVY3,color=navy,prod_size=3|sku=K2-NAVY4,color=navy,prod_size=4|sku=K2-NAVY5,color=navy,prod_size=5|sku=K2-NAVY6,color=navy,prod_size=6|sku=K2-NAVY7,color=navy,prod_size=7|sku=K2-NAVY8,color=navy,prod_size=8|sku=K2-NAVY10,color=navy,prod_size=10|sku=K2-NAVY12,color=navy,prod_size=12″,”color=Color, prod_size=Size”,

  20. Karick says:

    Hi. Thanks for that.
    But maybe someone know how to run this import process in the code?

  21. Priti says:

    Hi i am trying to import using the file attached in the above blog. Everything goes right except product’s add to cart button is not visible at the frontend.
    After importing configurable product’s price is blank and quantity is 0 at the backend. Also stock status is in stock.

    Can anybody suggest where i am wrong? or what i may be missing?

    • Vik says:

      By default if you import with qty=0 the product is not available on the front end even if in_stock = yes.

      You can change the default behaviour, check the magento documentation or provide a qty.

Leave a Reply to Pedro