Magento 2 Import Products and Product Options

Magento 2 is pretty straightforward when it comes to creating products. You can easily create any type of product via the admin panel by filling out the corresponding fields. But is it always efficient?

When you have to create a whole batch of products, doing it one by one won't be effective by any means. Thus, you'll need a more effort-friendly solution.

In such cases, you can resort to Magento import products. If you haven't imported products and product options in Magento 2 yet, we'll give you a hand.

Ready?

Things to Know Before Magento Product Import

Before we start with the Magento 2 import products there are a few things you have to know. 

Just like Magento export, Magento import works with the CSV file types. So you have to know how to work with them before you start the import. 

The best way to do this?

Google Sheets for sure. The main benefit is it's completely free and you most likely already have a Google account to use it. Besides, Google Sheets don't break the CSV formatting and you can download the file without any changes to the separator or delimiter values.

We do not recommend using Microsoft Excel or Open Office, since they are not as easy to work with. However, you are free to choose any option you prefer.

CSV File Structure

When preparing a CSV file for import you need to know how to structure data there. The following table might help. It describes the CSV file structure in closer detail.

Column Example Description
sku sku_123 An alphanumeric identifier is used to track inventory. It can be up to 64 characters long with letters and numbers separated by underscores or dashes. (SKUs with more than 64 characters will cause the import to fail)
store_view_code English Specifies the store views where the product is available. If you leave it blank the product will be assigned to the default store view.
attribute_set_code Default Assigns a product to a specific attribute set (you should have attribute sets created before importing products) based on the product type. If the product is created, you can't change the attribute set.
product_type simple Defines the type of product: simple, grouped, configurable, virtual, bundle.
categories Default Category/Gear,Default Category/Gear/Fitness Equipment Defines a category assigned to a product. Separate category paths with the pipe (|) symbol.
product_websites base,website2 Indicates a website code where the product is available. To set multiple websites, separate each with a comma without a space.
name Sprite Yoga Strap 6 foot The name of the product.
description <p>The Sprite Yoga Strap is your untiring partner in demanding stretches, holds and alignment routines. The strap's 100% organic cotton fabric is woven tightly to form a soft, textured yet non-slip surface. The plastic clasp buckle is easily adjustable, lightweight and durable under strain.</p><ul><li>100% soft and durable cotton.<li>Plastic cinch buckle is easy to use.<li>Three natural colors made from phthalate and heavy metal-free dyes.</ul> Defines the product description. Can include valid HTML tags.
short_description <p>The Sprite Yoga Strap is your untiring partner in demanding stretches, holds and alignment routines.</p> Identifies product short description. Includes valid HTML tags.
weight 1 The weight of the product is in the 1.00000 format.
product_online 1 Determines whether a product is enabled (1) or not (0).
tax_class_name Taxable Goods Defines the name of the tax class associated with this product.
visibility Catalog, Search Defines whether a product is not visible individually, in the catalog, in search, or both catalog and search.
price 14 The price of the product.
special_price 10 A discounted price of the products during a specified period.
special_price_from_date 2022-07-19 03:34:20 A date when the discount price is activated.
special_price_to_date 2022-07-19 03:34:20 A date when the discount price is deactivated.
url_key sprite-yoga-strap-6-foot Defines the part of the URL that identifies a product.
meta_title The Best Sprite Yoga Strap 6 foot A meta title of the product that appears in the search results list.
meta_keywords sprite yoga, best sprite yoga strap, yoga strap Meta keywords are separated by a comma with space.
meta_description The Sprite Yoga Strap is your untiring partner in demanding stretches, holds and alignment routines. Product meta description.
base_image https://magefan.com/blog/wp-content/uploads/2022/07/sprite-toga-strap.png Defines a relative path for the main product image. (images should be uploaded to pub/media/import). You can also use the direct URL of the image.
base_image_label Base image "Alt Text" A label of the base product image.
small_image https://magefan.com/media/logos/default/logo.png A name of the small image file that is used on catalog pages preceded by a forward slash.
small_image_label Small image "Alt Text" A label associated with the small image.
thumbnail_image https://magefan.com/media/logos/default/logo.png A file name of the thumbnail image that will appear on the product page gallery preceded by a forward slash.
thumbnail_image_label Thumbnail image "Alt Text" A label associated with the thumbnail image.
created_at 2022-07-19 03:34:20 Defines the date when the product was created. Use the following format: yyyy-mm-dd hh-mm-ss.
updated_at 2022-07-19 03:34:20 Defines the date when the product was last updated. Use the following format: yyyy-mm-dd hh-mm-ss.
new_from_date 2022-07-20 03:34:20 Specifies a date when the product starts to be featured as a new product. Use the following format: yyyy-mm-dd hh-mm-ss.
new_to_date 2022-07-20 03:34:20 Specifies a date when the product stops being featured as a new product. Use the following format: yyyy-mm-dd hh-mm-ss.
display_product_options_in Block after Info Column Determines where product options should appear on a product page if a product has multiple options.
map_price 10 A minimum advertised price of the product.
msrp_price 10 A manufacturer's suggested product price. 
map_enabled 0 Determines if the Minimum Advertised Price is enabled.
gift_message_available   Determines if a gift message will be displayed for a product during purchase.  
custom_design   List themes that can be applied to a product page.
custom_design_from 2022-07-30 12:12 Specifies a date when the selected theme is applied to the product.
custom_design_to 2022-07-30 12:12 Specifies an end date when the selected theme is applied to the product.
custom_layout_update   Specifies additional XML code that is applied to the product page layout.
page_layout   Defines the layout of the product page: No layout updates, 1 column, 2 columns with left bar, 2 columns with right bar, 3 columns, empty.
product_options_container Block after Info Column Determines where product options will be displayed on the product page.
msrp_display_actual_price_type Use config Determines where to display the actual price of the product for a customer; in the cart, before order confirmation, on gesture.
country_of_manufacture Ukraine Identifies the country where the products were manufactured.
additional_attributes has_options=1,quantity_and_stock_status=In Stock,required_options=0 Defines additional attributes created for a product. (custom product options)
qty 100 Quantity of products that are currently in stock.
out_of_stock_qty 0 The stock level to determine when the product is marked as out of stock.
use_config_min_qty 1 Determines whether to use the default value from the config.
is_qty_decimal 0 Determines if the qty attribute has a decimal value. Set 1 is the qty can be decimal.
allow_backorders 0 Defines whether your store allows backorders. Set 1 if you allow backorders.
use_config_backorders 1 Determines whether to use the default backorders config.
min_cart_qty 1 Defines the minimum qty of the product that can be purchased per order.
use_config_min_sale_qty 0 Determines whether to use the default value from the config.
max_cart_qty 0 Defines the maximum qty of the product that can be purchased per order.
use_config_max_sale_qty 1 Determines whether to use the default value from the config.
is_in_stock 1 Defines if the product is in stock.
notify_on_stock_below 1 Specifies the number of products that trigger the out-of-stock notification.
use_config_notify_stock_qty 1 Determines whether to use the default value from the config.
manage_stock 0 Defines if inventory control is used to manage a product. Set 1 to control the stock quantity.
use_config_manage_stock 1 Determines whether to use the default value from the config.
use_config_qty_increments 1 Defines whether to use product quantity increments from the store config.
qty_increments 0 Determines if the product is sold in quantity increments.
use_config_enable_qty_inc 1 Determines the default config setting to enable quantity increments.
enable_qty_increments 0 Defines if the quantity increments are enabled for a product.
is_decimal_divided 0 Defines if some part of a product can be shipped separately.
website_id 1 Defines a specific website where the product is available. When blank, the product will be available on all websites.
related_skus 24-WG087,24-WG086 List of the related products' SKUs comma-separated.
related_position 1, 2, 3, 4 Determines the position of the SKUs listed as related products.
crosssell_skus 24-WG087,24-WG086 List of the cross-sell SKUs comma-separated.
crosssell_position 1, 2, 3, 4 Determines the position of the SKUs listed as Cross-sells.
upsell_skus 24-WG087,24-WG086 List of the up-sell SKUs comma-separated.
upsell_position 1, 2, 3, 4 Determines the position of the SKUs listed as Upsells.
additional_images https://magefan.com/media/logos/default/logo.png The file names of all additional images associated with a product.
additional_image_labels Additional image "Alt Text" Labels of the additional images associated with a product.
custom_options name=Custom Yoga Option,type=drop_down,required=0,price=10.0000,price_type=fixed,sku=,option_title=Gold|name=Custom Yoga Option,type=drop_down,required=0,price=10.0000,price_type=fixed,sku=,option_title=Silver|name=Custom Yoga Option,type=drop_down,required=0,price=10.0000,price_type=fixed,sku=yoga3sku,option_title=Platinum  Defines the values and properties assigned to each custom option.


Now that you know what columns the CSV file contains and what each of them means, you can move to the Magento import products.

How to Import Products in Magento 2?

Magento product import might seem a bit complicated at first glance since you need to import product images separately. But we've got you covered.

To import products to Magento 2:

1. Navigate to System > Data Transfer > Import and choose Products as the Entity Type. 

Import Product in Magento 2

Note: you can download the sample file right on this step to make sure your CSV file follows the sample. Also, make sure the size of the import file doesn't exceed the limit of 2M. But note to upload images to pub/media/import if you want to specify image paths in the CSV file.

2. Configure Import Behaviour

  • Select what Import Behaviour you prefer in a corresponding field: Add/Update, Replace, Delete.

Note: the replace and update options are mostly used when you need to update product information. Alternatively, you can update products in bulk directly in the admin panel.

  • Define the Validation Strategy to determine what happens if any errors occur during import.
  • Set the Allowed Errors Count to define how many errors can occur before the import is cancelled.
  • Accept the default value on a comma in the Field separator and Multiple value separator fields.
  • Check the Fields Enclosure if you want to enclose any special characters found in the data.

Magento Import Behaviour

3. Move to the Import File section.

Here you have to Select File to Import, upload your CSV file, and enter the relative path to the server where uploaded images are stored in the Images File Directory field.

File to Import

Once you fill out all of the required fields, click the Check Data button in the upper-right corner and wait for the process to complete. 

Magento Import Validation

If your CSV file is valid, press Import and import products to Magento 2. You can track the import via System > Data Transfer > Import History.

Magento Import History

And this is how you import products in Magento 2. The Magento import products feature is more than enough to perform some basic editing or updating tasks. Now that you have the needed products at hand, you can continue managing them.

However, once you need to change or replace them, you'll need to export products in Magento 2.