Get Free Audit

How to Import & Export Products in Magento 2

May 5, 2024

22313 Darya Novik

How to Import & Export Products in Magento 2

Instead of adding or extracting product data one by one from the admin panel, there is a way to save time and effort by Magento product export and import with a CSV product upload sheet. Currently, there are a number of Magento modules that facilitate this process, yet in this article, I will describe the standard method of Magento 2 import and export of products.

You will learn how to work with product information in Magento 2, in particular, how to import and export products. Moreover, you will find the list of the most common import validation errors together with the example of import tables.

Table of contents:

How to Get Magento 2 Export Products in CSV
How to Import Product Magento 2 in CSV
Magento 2 Import Common Validation Errors

bg request magento
Get a consultation from the BelVG team Contact us and we’ll help you improve your Magento store. Contact us

How to Get Magento 2 Export Products in CSV

Magento has a default module for importing and exporting products – Magento_CatalogImportExport. In addition to it, there are many modules from third-party developers that allow you to set up a more flexible import and export of products (for example, Google / Facebook and other product processing systems). Here is what you need to do for Magento 2 export products.

Step #1: Log in to the admin panel and navigate to System -> Data Transfer -> Export.

image

 

Step #2: Select Entity Type -> Products. Export File Format is available in CSV format.

image 1

Step #3: Set Fields Enclosure at Checked to prevent the export of incorrect symbols, like equal sign, more and less characters, single and double quotes, backslashes, space characters and ampersands. The system will enclose them in double quotes to avoid data export problems.

image 2

Step #4: Set up export configurations.

When using the Magento 2 export database, it is possible to filter products by the list of attributes. For instance, if you set up the SKU field at TEST, only products that have the word TEST in their SKU will be exported.

You can also exclude certain attributes from export by checking the Exclude checkbox to the left of the name.

image 3

Bear in mind that currently you can not make Magento export products for a certain website or store, because the platform exports all products.

Step #5: Press the Continue button and export a product CSV file.

Magento Custom Development blog icon

Magento Custom Development by BelVG

Customize your online store with Magento extensions by BelVG

Download here

How to Import Product Magento 2 in CSV

Step #1: Log in to the admin panel and navigate to System -> Data Transfer -> Import.

how to import magento

Step #2: In the Entity Type field select Products.

image 4

 

Step #3: Create a product CSV file.

Click Download Sample File to upload the sample of how to fill in the CSV product import file. Use the UTF-8 coding while creating or editing CSV file to avoid validation issues during the import.

image 5

 

 

image 6

Magento has several scenarios of product import:

  • Add/Update – Magento checks the availability of products with the specified SKU. If no match to the SKU is detected then new values are added to the product, and in case no such product exists, the system creates it.
  • Replace – product attribute values are substituted for the new ones.
  • Delete – if there is a product with a certain SKU in the import file, the product is deleted from Magento.

image 7

 

Moreover, Magento implements several error processing algorithms. When you use the Stop on Error option, any file validation error will not allow to run the import. There is a Skip error entries function allowing to specify the variety of errors you can run the import with.

 

image 8

By default, Magento uses a comma to separate values in a CSV file (Field separator), yet you can specify another separator you used to create or edit an import file. Similar to this, you can set up a Multiple value separator.

image 9

 

To prevent incorrect data import, like equal sign, more and less characters, single and double quotes, backslashes, space characters and ampersands, check the Fields Enclosure. This way Magento will add additional double quotes to prevent special symbol import.

 

image 10

Step #4: Specify the CSV file in the Select File to Import field.

image 11

 

Magento allows to import files with a limited number of fields, only the required ones. If you do not need to fill in all the fields you got as a result of Magento 2 product export, specify only the required ones: sku, product_websites, product_type, attribute_set_code, categories, name, price, qty, additional_attributes.

Vlad Yunusov

Partner With Us

Let's discuss how to grow your business. Get a Free Quote.
Talk to Vlad

In case you need to import images as well, you need to specify the path to the folder with media files. If you import images from the local server, specify the path relative to the current Magento installation, for example, var/media/import_products or the standard pub/media/import.

image 12

The folder should have the same image path structure as the import file (if in the import file the path is /9/4/94111017_2_5.png, them physically the picture is located at var/import/mages/9/4/94111017_2_5.png.) When you import from the cloud server, you specify the complete image address.

image 13

 

When importing products, it is also possible to create the structure of categories specified in the categories field. Bear in mind that the categories must be created in accordance with the specified hierarchy, for instance if you have a value for categories field All Products / Main / Second, then Magento will create the All Products category first, then create the Main one as a child for her and after that Second as a child for Main and assign a product for these categories. If there is a parent category, then Magento will add children for her. If all categories exist, then the product will simply be added to these categories without creating new ones.

image 14

 

Some products require additional attributes import, for example, the ones created by the admin. During the CSV export the fields are united in a single additional_attributes field. Such format is not very useful for editing or adding new attributes, therefore, it is better to create separate columns for each attribute and specify their values there.

image 15

 

 

If you want to make Magento import product groups, you need to specify SKU values in the associated_skus field, like in the example below. For configured products, fill in the configurable_variations fields (in the format sku=PRODUCT_SKU, attribute=value|sku=PRODUCT_SKU2, attribute=value2) and configurable_variation_labels). Similarly, specify the values for bundle items in the bundle_values field.

image 16

 

image 17

Step #5: Press Check Data to validate the import file.

image 18

 

Step #6: In case there are no errors or they are included into Allowed Errors Count, you can import Magento CSV product file.

image 19

 

 

image 20

image 21

 

image 22

Magento 2 Import Common Validation Errors

1.Incorrect value of the select fields. To resolve it, find the values of the attribute at Stores -> Attributes -> Product and compare with the ones specified in the CSV file.

image 23

 

2. Images loading errors. The reason may lie in the physical absence of images at the server (in the specified Images File Directory folder), or in incorrect rights for the files and folders, or in the incorrect path.

image 24

 

3. Different number of fields and product info. This happens because Magento processed the CSV file incorrectly. Check the separators and double quotes in the CSV file and if some of them are absent, add the missing signs.

 

image 25

4. Errors with URL Rewrites. This error occurs when another product has the same URL rewrite as we try to import or other custom URL rewrite. The solution is to add any postfix into the import file or delete the conflicting URL Rewrite.

image 26

 

5. Incorrect product_type. One of the reasons the issue occurs is the use of third-party modules for defining new product types or incorrect values in the product_type field. The solution is to check the data in the import file or install a third-party module that this type of product adds (if not installed).

image 27

 

6. Incorrect visibility. The reason for it is using invalid values for the visibility field. The solution is to use standard Magento text values (Not Visible Individually => 1 / Catalog => 2 / Search => 3 / Catalog, Search => 4).

image 28

 

7. Incorrect store. Occurs due to the absence of the configured store or an error in the field data. The solution is to check if this store exists and create the store if it does not. Moreover, check whether the values of field and store identifier values correspond.

image 29

 

8. Incorrect separator or format. The error occurs when the file is created with the separators different from the ones specified in the import. The solution is to check what separator is in the CSV file and specify the same in the import configuration.

image 30

 

Wrapping it up

From the article you have learned how to import and export product data in Magento, as well as got acquainted with the most common import validation errors. If you have any questions or comments, please leave them down below.

If you are looking for a functional Magento extension, go to https://store.belvg.com/.

Contact Us To calculate the price of your Magento store and improve it for business growth. Get Upgrade Estimate

3 Comments

  1. Hi! Thanks a lot for your informative article. In case you’re interested in automation of CSV import and export to Magento.

  2. Thank you for such a great article it could be helpful for many people like me which looking for a solution to make some time-management on Magento.

  3. Thanks for this great and detailed guide. All the steps look very clear and easy to follow.

    Keep up the good work!

Post a new comment

BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *