The Complete Guide to Magento 2 Product Import / Export

- Magento 2
 

Magento 2 Product Import Export Tutorial

Magento 2 and Magento 1 a quite different systems. Despite both have a lot of common features, there are some core differences between them as well. For instance, there are some unique opportunities related to Magento 2 product import/export. I’ve already written about import / export in Magento 1, so you can easily compare the old procedure with the new one. As for product import / export in Magento 2, it is fully described below.

The Best Improved Import/Export Extensions for Magento 2 | Download / Buy Firebear Improved Import Magento 2 Extension | Magento 2 product import export by Benno Lippert | Firebear Improved Import Export Magento 2 Extension FAQ

The platform offers an improved import / export system out of the box. Thus, with Magento 2, you get such vital features as product custom options and images from remote URLs without any need to install third party extensions.

Magento 2 Features listed below became a part of the platform. As for the 1.X, they are not available until you install additional modules. So, the new version of the platform provides the ability to import or export:

  • Product custom options
  • Product images from remote URL
  • Extended configurable products
  • Tier and group prices
  • Related products, upsell and cross-sell products

How to Export Products in Magento 2

1. First of all, you should go to “System -> Export”

How to Export Products in Magento 2

2. Then, it is necessary to select “Products” on the “Entity” dropdown.

How to Export Products in Magento 2

3. Now, you can set up filters as well as exclude unnecessary.

4. Click “Continue”

5. Get your formated csv files with Magento 2 products.

How to Import Products to Magento 2

  • Сheck this complete CSV sample with all fields optimized for importing products into Magento 2: Magento 2 csv sample data. The file includes all products from Magento 2 official sample data.
  • To download images for the CSV, follow this link: sample data.zip. Keep in mind that it should be unzipped, and images should be uploaded to your Magento 2 root folder /pub/media/import.
  • Additionally, you can find the official Magento 2 CSV sample in a dropdown related to import. Go to “System -> Import”.

A general product import workflow in Magento 2 consists of the following steps:

1. In Magento 2 admin, go to “System -> Import.”

How to Import Products to Magento 2
2. Select a product on the “Entity” type of a dropdown

How to Import Products to Magento 2
3. Select an import behaviour option. Choose among “Add new records,” “Update,” or “Replace” existing products.

How to Import Products to Magento 2
4. Select your CSV file. Use the “Select File to Import” option and then click “Check Data” – if data is correct, start importing products to Magento 2!

The CSV File Structure

Let’s have a look at CSV file structure for Magento 2 product import. Below, you can find a detailed description of its columns.

  • sku – a unique product identifier used as a key product attribute in the Magento 2 core. It is required for all products and should be unique for each of them. sku can include both digits and letters without spaces separated with underscores (_) and dashes (-).
  • store_view_code – an associated store view code. The column can be empty if an associated store / website have a single sub item.
  • attribute_set_code – a product attribute set code. Create and configure an attribute set before importing products into Magento 2. It should look exactly the same as an attribute set name including capital letters (e.g. “Default”, “Man shoes” etc.)
  • product_type            – the type of an imported product. Use only lowercase letters (small, configurable etc.)
  • categories – product categories in Magento 2 differs from ones utilized in Magento 1, where comma separated category ids are used. In Magento 2, full names of assigned categories, including full path, are required. Besides, assigned categories should be separated by |. For instance, “Default Category/Gear|Default Category/Gear/Bags” means that product should be assigned to both Gear and Bags categories. The latest one is a subcategory of Gear.
  • product_websites – an associated product website code. Use lowercase letters only (e.g. “base”).
  • name – a product name.
  • description a product description.
  • short_description a short description of a product. Both, description and short description, could include valid HTML tags.
  • weight  a weight of a product. Requires using the following format 1.00000.
  • product_online – enables or disables products. Use 1 or 0 respectively.
  • tax_class_name a product tax class. Allows using capital later and spaces, like in Magento 2 backend (e.g. “Taxable Goods”).
  • visibility – a visibility of a product (e.g. “Catalog, Search”, “Not Visible Individually” etc.).
  • price a price of a product (e.g. 34.000).
  • special_price – a special price of a product (e.g. 34.000).
  • special_price_from_date – time when Magento starts using a special price instead of a default one (e.g. ‘2015-09-01 15:26:29’).
  • special_price_to_date – time when MAgento stops using a special price (e.g. ‘2015-09-01 15:26:29’).
  • url_key – an URL key of product. In case of an empty field, a value is generated automatically based on a product name.
  • meta_title – a meta title of a product.
  • meta_keywords – product meta keywords
  • meta_description – a product meta description
  • base_image the main product’s image and its path. Should be uploaded to  /pub/media/import. The path of /sample_data/m/b/mb01-blue-0.jpg has the following structure: /pub/media/import/sample_data/m/b/mb01-blue-0.jpg. In addition, you can use a direct URL of an image, such as http://site.com/images/some_image.jpg.
  • base_image_label – a label of a base product image.
  • small_image – a name and a path related to a small product image. Should be also uploaded to /pub/media/import. The path of /sample_data/m/b/mb01-blue-0.jpg has the following structure: /pub/media/import/sample_data/m/b/mb01-blue-0.jpg. In addition, you can use a direct URL of an image, such as http://site.com/images/some_image.jpg.
  • small_image_label a label of a small product image.
  • thumbnail_image – a name and a path related to a thumbnail product image. Should be uploaded to /pub/media/import as well. The path of /sample_data/m/b/mb01-blue-0.jpg has the following structure: /pub/media/import/sample_data/m/b/mb01-blue-0.jpg. In addition, you can use a direct URL of an image, such as http://site.com/images/some_image.jpg.    
  • thumbnail_image_label – a product thumbnail label
  • created_at time when a product was created. Use the following format: yyyy-mm-dd hh-mm-ss (e.g. 2015-09-01 22:26:27). If the field is empty, date and time of data base record are used.
  • updated_at time when a product was updated in. Use the following format: yyyy-mm-dd hh-mm-ss (e.g. 2015-09-01 22:26:27). If the field is empty, date and time of data base record are used.
  • new_from_date – sets a product as “new” from the specified date. Use the following format: yyyy-mm-dd hh-mm-ss (e.g. 2015-09-01 22:26:27).        
  • new_to_date stops displaying a product as “new” from the specified date. Use the following format: yyyy-mm-dd hh-mm-ss (e.g. 2015-09-01 22:26:27).       
  • display_product_options_in it is a new feature introduced in Magento 2 which specifies a place on a product page where a block with options should be displayed (e.g. “Block after Info Column”).
  • map_price – a minimum price of a product.
  • msrp_price – a product’s MSRP price.
  • map_enabled – use it to enable / disable a product’s minimum price.
  • gift_message_available – shows that a gift message is available and will be displayed for a particular product.
  • custom_design – a custom design of a product page.      
  • custom_design_from – a starting date for a custom design of a product page.
  • custom_design_to an end date for a custom design of a product page.
  • custom_layout_update – a custom XML layout for a product page
  • page_layout a product page layout (e.g. 1 Column). If empty the field is empty, a default product layout is used.
  • product_options_container – a product options container.
  • msrp_display_actual_price_type   a type of a product’s MSRP price.
  • country_of_manufacture – a country of origin.     
  • additional_attributes – import of product custom options and data related to a simple product associated to a configurable product. A sample value for a simple product associated to configurable product: “color=Red,has_options=0,required_options=0,size_pants=32” (Color attribute is “Red,” simple product has options in Magento 2: has_options = 0 – no required options, size pants attribute value is 32). A sample value for a configurable product in Magento 2 – “has_options=1,required_options=1” (Product has required options, simple product SKU is associated in the _associated_sku column ).
  • qty – a quantity of a particular product in stock.      
  • out_of_stock_qty an out of stock quantity of a particular product.
  • use_config_min_qty – use minimum quantity value from config.
  • is_qty_decimal set 1 if a quantity can be decimal.         
  • allow_backorders set 1 if backorders are enabled.
  • use_config_backorders – use a default system value for back-order options (enable / disable).
  • min_cart_qty – a minimum required quantity of a product in shopping cart.
  • use_config_min_sale_qty – use a default config value for determining a minimum quantity of a sale product.
  • max_cart_qty – a maximum quantity of a product in a shopping cart.     
  • use_config_max_sale_qty –  use a default config value to determine a maximum quantity of a product in a shopping cart.
  • is_in_stock – 1 – a product is in stock, 0 – a product is out of stock.
  • notify_on_stock_below –  set a minimum product quantity to start a notification about a low stock level.
  • use_config_notify_stock_qty – use a default system value for a product’s low stock notification.
  • manage_stock to control a stock quantity of a product set 1. By setting 0 you allow  Magento 2 to consider a product has an unlimited stock level.
  • use_config_manage_stock – use a default system configuration value for stock management.
  • use_config_qty_increments – use a product quantity increment from current store configuration. Set 1 to enable; set 0 to disable.
  • qty_increments – a product quantity increment.
  • use_config_enable_qty_inc  use a default store configuration value to enable a product quantity increment.
  • enable_qty_increments – set 1 or 0 to enable or disable product quantity increment.
  • is_decimal_divided set 1 if a product quantity increment can be decimal.
  • website_id an associated product website ID
  • related_skus related products SKUs separated with commas (e.g. 24-WG085_Group,24-WG086,24-WG083-blue,24-UG01)
  • crosssell_skus – cross-sale product SKUs separated with commas (e.g. 24-WG085_Group,24-WG086,24-WG083-blue,24-UG01)
  • upsell_skus upsallers product SKUs separated with comma (e.g. 24-WG085_Group,24-WG086,24-WG083-blue,24-UG01)
  • additional_images – additional product images (product media gallery) separated with commas. Images should be uploaded to /pub/media/import. The path of /sample_data/m/b/mb01-blue-0.jpg has the following structure: /pub/media/import/sample_data/m/b/mb01-blue-0.jpg. In addition, you can use a direct URL of an image, such as http://site.com/images/some_image.jpg.                                      
  • additional_image_labels Сomma separated labels for additional product images from the previous column.
  • _associated_sku an associated simple product SKU for a configurable product (several values should be separated with commas).     
  • _associated_default_qty a default quantity for associated products
  • _associated_position associated products position, based on the _associated_sku column

How to Import Tier Prices to Magento 2

If you need to import tier prices to Magento 2, go to System -> Import -> Import Settings -> Advanced Pricing. Here, you should select “Advanced Pricing” from a dropdown list. Next, select “Add/Update” in “Import behaviour”.

As for a CSV file, you should remove ALL Groups Column, if there is such.

You CSV should have a similar structure:

sku

tier_price_website

tier_price_customer_group

tier_price_qty

tier_price

1001-102

All Websites [USD]

ALL GROUPS

1

10

1001-102

All Websites [USD]

ALL GROUPS

3

9

1001-102

All Websites [USD]

ALL GROUPS

6

8

Now, you should easily import Magento 2 tier prices to your website. This procedure allows to save hours of time necessary for manual configuration in the backend. Alternatively, you can export a CSV, edit the file, and reimport it back. This also helps to save time necessary for applying changes to tier prices.

How to Import Configurable Products to Magento 2

Unfortunately, Magento 2 configurable products import is quite a complicated procedure. You can easily improve it with the help of third-party extensions, but below we describe how to achieve the goal with the native functionality of Magento 2. The procedure is divided into several steps, so let’s start with prerequisites.

  • Go to Stores -> Attributes -> Products. Here, you should create and define product attributes.
  • Next, it is necessary to create attribute sets for product attributes you want to import. Perhaps, these sets already exist, but you should check them under Stores -> Attributes -> Attribute Set in any case. If sets are not available, create them.
  • And don’t forget to set up categories properly. It means that categories you are going to import configurable products to should be created before import. You can manage them under Products -> Categories.
  • And may be the most important and unobvious thing: neither simple, nor configurable products should exist in your Magento 2 catalog before import. These are mandatory rules, and we can’t find a way around (until you start using third-party modules).

Now, let’s tell a few words about CSV file requirements. It is not a secret that Magento 2 import/export is based on CSV files, but if the requirements are not satisfied, you will never perform Magento 2 configurable products import. Therefore, be less dismissive to the following requirements.

  1. Use comma as the field and multiple value separator. This parameter can be changed during the import, but it often leads to failures, so we recommend to cope with this requirement.
  2. In a CSV file, list simple products before the configurable product. Otherwise, you will never import your the desired items to your website.
  3. Pay closer attention to the “attribute_set_code” field. It is very important for the whole procedure, because of vital data. The field should match the Attribute Set that contains the attributes for each product.
  4. Another important field is “configurable_variations”. Here, a pipe separated set of sku/option combinations for each simple should be created. Also note that it should be populated for the configurable product only.
  5. The last requirement is true to the “configurable_variation_labels” field – it should be populated only for the configurable product. And don’t forget that it’s role is to correlate the Attribute code to the Label Name.
  6. And in the “additional_attributes” field, list options for each simple product. Separate multiple attributes with comma.

Now, we’d like to draw you attention to the example of a CSV file. For instance, we’d like to import a shirt that comes in three colors: black, white, and red. Thus, the Product Attribute “color” defines these three colors and exists in the “Default” Attribute Set. As a result, you should import 4 products: 3 simple products – black shirt, white shirt, and red shirt, and the configurable one – shirt. As for key fields of a CSV file, they are:

  • additional_attributes: for the Black shirt: color=Black; for the White shirt: color=White; and for the Red shirt: color=Red;
  • configurable_variations: For the configurable shirt product: “sku=shirt-black,color=Black|sku=shirt-white,color=White|sku=shirt-red,color=Red”;
  • configurable_variation_labels: for the configurable shirt product – color=Color.

sku

store_view_code

attribute_set_code

product_type

categories

product_websites

name

description

short_description

weight

product_online

shirt-white

Default

simple

Default

Category/Gear/Bags

base

T-Shirt

0

White

shirt-black

Default

simple

Default

Category/Gear/Bags

base

T-Shirt

0

Black

shirt-red

Default

simple

Default

Category/Gear/Bags

base

T-Shirt

0

Red

shirt

Default

configurable

Default

Category/Gear/Bags

base

T-Shirt

1

As you can see, Magento 2 configurable product import is extremely complicated. The procedure has lots of requirements, but you can easily improve it with the help of reliable Magento 2 import/export extensions.

How to Import Custom Options to Magento 2

As a Magento administrator, you can configure Magento 2 custom options manually, but there is one serious problem: the process is time-consuming. Therefore, it is a good idea to apply custom options in bulk. It means that you should run Magento 2 custom options import.

The default Magento 2 import tool allows to upload custom options together with products, so you should assign all customizable fields to one product and nest them in one file column in the following format:

  • For Text, File, or Date Type

  • For Select Type

Where:

  • Magento 2 custom option name – specify custom option name as it should display for customers at the frontend (for example Print, Color, Shipped Till)
  • Type – input type for custom option to be created (dropdown, image, date, multiple select, text field, etc)
  • Required – mark this field as required using 1 value and respectively put 0 if customer is not obliged to adjust this option before adding product to cart
  • Price – if the customization, represented by Magento 2 custom option, should draw additional cost specify its value
  • Price_type – decide on price type, to be exact how custom option price will be calculated – by percentage from simple product price or as fixed value
  • SKU – provide unique identifier for each custom option
  • Option_title – if you import custom option of select type, you are supposed to configure its value

You must admin that it is not the easiest procedure, but, as you might have already guessed, you daily import routine can be simplified with a Magento 2 import extension.

How to Import / Update Product Stock in Magento 2

To import product stock data in Magento 2, you only need a CSV file with two columns: sku & qty. The “qty” column represents the full stock value, so you can’t increase/decrease the stock value by importing a CSV file manually. You can only specify the new amount. Let’s look at the example:

sku

qty

667

100

A CSV file with such parameters will apply a quantity of 100 items to the product with SKU 667. Beside, it will set “Stock Availability” to “In Stock” if previously the qty parameter was 0 and “Stock Availability” was “Out of Stock”.

Improved Import / Export for Magento 2

If you want to improve the existing Magento 2 import / export functionality, pay attention to our Improved Import / Export extension, which provides the ability to import your csv files with products data and product images to Magento 2 from a remote FTP server, Dropbox or a direct URL of a source CSV file as well as offers a dedicated categories import from CSV files, on the fly import of product attribute values, cron jobs import, and more!

The Improved Import Export Magento 2 Extension by Firebear

The module provides the ability to import a file with product data and images in a hassle free manner, since the process can be very precise due to mapping. The following GIF illustrates how the feature is implemented:

Unbenannt-1

As for other features, they are:

  • Import via FTP , Dropbox, or direct URL (for both product data and images);
  • Dedicated simple categories import via CSV;
  • Flexible Import mapping;
  • New product attributes and attribute values on the fly;
  • Advanced cron job import for products, categories, customers, stocks, and attributes;
  • Configurable and downloadable products are fully supported;

The following features will be available soon :

  • CSV mapping presets for Magento 1.x CE & EE, Shopify,  WooCommerce, and other ecommerce platforms;
  • API connection between Magento 2 and cloud-based SAAS ecommerce platforms;
  • Improved Import auto-upgrade to keep your Improved Import copy always fresh;
  • Flexible import of large compressed data (unzip / untar archive before import);
  • Export mapping + custom data structure mapping for categories, customers, discount codes, catalog price rules, etc;
  • Automated product data translation for different store views;
  • Data crawling services API  integration;
  • XLSX files native import and mapping;
  • Unit and integration tests;
  • API for Magento 2 Import and Improved Import functionality.

Note that all these updates will be provided for free after their releas if you purchase the extension now. For further information, follow these links:

Download / Buy Firebear Improved Import / Export Magento 2 Extension

Improved Import Magento 2 Extension Manual

Final Words

As you can see, Magento 2 provides much better import/export capabilities than 1.x but it can still be improved with the help of third-party modules. And the Magento ecosystem offers tons of reliable solutions, so you are free to choose one that suits your particular ecommerce needs.