How to Import Products with Custom Attributes to Magento 2

- E-Commerce, Magento 2

Magento 2 import export debug log

In the following article, we provide several tips on how to import products with custom attributes to Magento 2 with no headaches. Below, you will find recommendations regarding how to avoid the most common errors, automate the procedure, create unavailable attributes on the fly, and match external categories to the ones you use in your e-commerce catalog. You can find more useful tips here: Developer’s Cookbook.

'

Import Products with Custom Attributes to Magento 2 without Errors

You can import products with custom attributes to Magento 2, applying the same algorithm as the one you use with products that incorporate default attributes. But there is a notable exception that we’ve discovered in this discussion on StackExchange. While you can use absolutely the same mechanisms and tools, you should keep in mind that some custom attributes may lead to errors, disrupting data transfers. 

Ankit Shah detailly described his import case here. The author of the discussion exported a file with product data and wanted to reimport it back. However, the system displayed the following error: 

Value for ‘product_type’ attribute contains incorrect value

And to make the long story short, we won’t rewrite all the conditions the author faced since they don’t make any difference from the perspective of our guide. The only thing we want to draw your attention to is the cause of the problem. 

A custom product attribute became a reason for the failed import. The author used a custom attribute called Product Type. As you might have guessed, its code was ‘product_type,’ which is also utilized by the same default attribute. As a result, Magento 2 recognized the custom attribute as a system one and applied the corresponding requirements to its values. However, the custom attribute utilized values that were not supported by default, causing the error.

To solve this problem, the author had to rename the custom attribute. After that, the issue was fixed, so Ankit freely imported products with custom attributes to Magento 2. 

If you don’t want to get into the same situation, we recommend you to avoid reserved words when you create custom attributes in Magento 2. In other words, don’t use names that are already utilized by the system. You can see all default product attributes and their values here: Magento 2 Product Attribute Reference. Learn them before importing products with custom attributes to Magento 2.

Import Products with Custom Attributes to Magento 2 Automatically

A general product import workflow in Magento 2 looks as follows:

  1. You go to the Magento 2 admin, System, Import.
  2. Select “Products” from the “Entity Type” dropdown. 
  3. Select an import behavior option.
  4. Check the data and upload a CSV file. 

While it is intuitive and straightforward, you cannot automate the process. It is necessary to repeat the same actions every time you want to import products with custom attributes to Magento 2. Use the Improved Import & Export Magento 2 extension to automate the procedure. While it offers a similar general workflow, our module also provides the ability to use schedules to transfer all types of products with custom attributes automatically. 

The extension utilizes cron to power the feature. You can create custom intervals or select predefined ones. At the same time, profiles with no schedule are still an option. And you can launch import whenever you want using asynchronous updates. The schedule configuration looks as follows:

Magento 2 CMS Blocks

Import Products with Third-Party & Custom Attributes to Magento 2

If your product data file contains not only custom attributes but also third-party system ones, you cannot import it using the default Magento 2 tools. However, the Improved Import & Export Magento 2 extension comes in handy again. The module offers mapping presets that modify third-party data according to the rules of Magento 2. You only need to select a predefined scheme suitable for your integration to let our plugin replace all external attributes with ones used internally. As for custom attributes, they stay untouched, while the Improved Import & Export plugin modifies a custom data file, making it suitable for import. The process looks as follows:

You can use the following add-ons to import products with custom attributes to Magento 2 modifying the corresponding third-party values:

  • WooCommerce Migration Add-on lets you seamlessly migrate from WordPress to Magento 2, transferring all the necessary product data. No programming skills are required to import WooCommerce products, customers, addresses, and orders.
  • MS Dynamics Integration Add-on provides the ability to connect Magento 2 to MS Dynamics Business Central ERP/CRM and synchronize product data between them.
  • Banggood Dropshipping Add-on introduces the easiest ways to start a dropshipping business with Magento 2. With this tool, you can connect your e-commerce store to the Banggood catalog and transfer product data to Magento 2.

More add-ons are available here: Magento 2 Extensions by Firebear.

Alternatively, it is possible to use an interface where you can prepare products with both custom and third-party attributes manually. Just choose an external system attribute and specify a replacement. You can apply similar actions to product attribute values. With Improved Import & Export, it is no longer a problem to map and edit them in bulk.  

Import Products with Custom Attributes and Third-Party Categories to Magento 2

Another mapping feature that lets you import products with custom attributes to Magento 2 is related to categories. When you transfer data from third-party systems, the module enables you to replace external category names with ones utilized internally. The process looks as follows:

And you can generate new on the fly. Choose a parent category first and then specify a new one. Next, the extension will connect products to this category. Check the following article for further information: Category Mapping.

Import Products with Custom Attributes to Magento 2 When Some Attributes Are Not Available

If your data file lacks some attributes, you can freely transfer it into the system using the Improved Import & Export Magento 2 extension. The module enables you to create attributes on the fly. So if a file with custom product attributes lacks some system ones, it is no longer a problem. You can specify the parameters necessary to generate the missing data automatically. The feature is described here: Product attributes import.

Import Products with Custom Attributes to Magento 2 in Different Formats

While Magento 2 lets you import data as CSV files only, the Improved Import & Export extension dramatically extends the default functionality. In addition to CSV, the module supports XML, Json, XLSX, ODS, and ZIP & TAR. It means that there is no need to convert files to CSV. Furthermore, the extension lets you import any XML file to Magento 2 based on XSLT instructions.

As for Json, this feature enables Rest API transfers and opens further opportunities than the default import tool offers. And the ability to import Excel and OpenOffice formats to Magento 2 lets you transfer them via XSL, XSLX, and ODS tables. 

Furthermore, you can import products with custom attributes in supported file formats even when they are compressed. With the extension supports ZIP & TAR archives and can unpack them automatically. You can transfer the information from the following sources:

  • REST and SOAP API;
  • Google Sheets;
  • Direct URL;
  • FTP/SFTP;
  • Dropbox;
  • Direct File Upload.

In addition to ALL product types, Improved Import & Export lets you transfer the following entities:

  • Categories;
  • Customers and Addresses;
  • Advanced Pricing;
  • Product Attributes;
  • Orders;
  • CMS Pages;
  • CMS Blocks;
  • Catalog & Cart Rules;
  • Gift Cards;
  • Reviews;
  • URL Rewrites;
  • Search Terms and Synonyms;
  • Widgets;
  • Page Hierarchy.

We are going to add more entities withing further updates.

Final Words

Custom attributes are no longer a problem if you know how to name them correctly. Don’t use the system attribute values to specify your custom ones to avoid import errors. If you want to go further with the data transfer simplification, use the Improved Import & Export Magento 2 extension. Our module lets you automate import processes moving all data whenever you specify. Besides, it provides the ability to replace third-party attributes and unsupported values when you import products with custom attributes to Magento 2. And you can freely restore the missing data due to the ability to create attributes on the fly. At the same time, Improved Import & Export lets you import products with attribute values using various file formats and sources so that you are no longer limited to CSV and file uploads. For further information, follow the link below:

Get Improved Import & Export Magento 2 Extension

'