How to Import Multiselect Attribute Values to Magento 2

Magento 2 import export debug log

In the following article, we explain how to get multiselect attribute values in Magento 2 via import and export processes. But how it it possible if the default data transfer tools don’t offer the desired functionality?

The default data transfer capabilities of Magento 2 still need various improvements, especially if you use the Open Source version of the platform. However, numerous community-based initiatives that tend to improve the basic functionality are at your service. They vary between coding tricks and standalone extensions. Depending on the complexity of your business, your technical skills, or the faced issues, you can select one that perfectly suits your needs. What to do if you cannot find the solutions? Ask the community for support. 

Recently, we came across an interesting issue on Stackexchange. The author was wondering whether it was possible to create values for a multiselect attribute when uploading a CSV file. Below, we share two solutions: the community-based algorithm for addressing the problem and the Firebear-proposed tool. While the first one requires additional coding experience and is almost unreal to implement for non-technical users, the extension we offer is admin-friendly and intuitive so that anyone can use it to cope with the difficulties described below. 

To make a long story short, let’s explore the issue and describe how Magento lets you get product multiselect attribute values. More tips are available here: Magento 2 Cookbook.

Impossible to import multiselect attribute values to Magento 2

Bennychaos tries to figure out how to create values for a multiselect attribute by uploading a CSV file. The author needs to populate a new multiselect attribute “Year.” 

He provides a few sample entries as well as the additional_attributes data that look as follows:

However, the expected multiselect attribute values weren’t created in the system.

How to get multiselect attribute values in Magento 2 via CSV

Franck Garnier reports that the discussed feature is not natively supported in Magento 2. However, the author offers a workaround to manage it. He adds new multiselect attribute options dynamically during CSV validation. The proposed solution works equally well for both manual import and Scheduled EE import. 

Franck points to the fact that you need to reload the attribute option cache for each line after every update, but it is not the biggest issue. The problem is that you need to create a new module so that this approach is aimed at coders only. Let’s see how to add multiselect attribute values by importing a CSV file according to the Magento community.

To create a new ImportExport module, you have to add the following dependencies in etc/di.xml first:

Next, Franck proposes to extend the following class

with this code: 

After that, you need to do similar manipulations over another class

Use the following code to extend it:

And the last step is related to this class:

You have to extend it with this code:

Although adding three code snippets looks quite simple, we don’t recommend you do that if you don’t have the proper experience. You can rely on another method instead. We describe a more user-friendly solution to importing multiselect attribute values to Magento 2 that requires no programming skills.

How to import Magento 2 multiselect attribute values

As for the Firebear-proposed solution, it doesn’t force you to discover continents again. It is only necessary to install the Improved Import & Export module to get product multiselect attribute values in Magento 2.

With our extension, you can freely upload Magento 2 product attributes, attribute sets, and attribute groups, controlling every single aspect. Of course, you can add new multiselect attribute values from a CSV table.  

Magento 2 product attributes EAV import and export

The Improved Import & Export extension simplifies the process of transferring any data to and from Magento 2 as well as lets you automate all import and export procedures. Furthermore, it is possible to import attributes and their values to Magento 2 from any external system. Let’s explore the general algorithm. 

Your first stop after you install the plugin is situated under System->Improved Import/Export->Import Jobs. You have to click “Add New Job” and configure the settings described below.

 Magento 2 attributes import

The system redirects you to the General Settings tab. Here, you can activate your new import job, specify its title, and add a schedule of transfers. Use the latter if you want to automate all further updates. Next, choose a language (locale) and enable/disable several more features.

 Magento 2 attributes import

After that, you can proceed to the Import Settings section. Select attributes as your import entity, enable/disable API synchronization depending on your needs, and select a platform to import data from. This option applies a mapping preset that replaces third-party attributes with the corresponding local ones.

 

Proceed to the Import Behavior tab. Select how to act with the imported file: add, update, replace, or delete attributes you transfer. Next, specify a validation strategy and a maximum number of errors. The tab also lets you add any custom separators.

 Magento 2 attributes import

In the Import Source section, select a file format and an import source. You are no longer limited by CSV files and direct uploads. Or extension lets you transfer data via XML, XLSX, JSON, or ODS from a local or remote server, URL, via direct uploads, or from Dropbox and Google Sheets. 

 Magento 2 attributes import

Hit “Save & Run” to add multiselect attribute values by importing a CSV file to Magento 2. 

Magento 2 Attribute Import FAQ

Below, you can see other tips on how to manage Magento 2 multiselect attribute values in your admin.

How to import multiselect attribute values to Magento 2 automatically?

If you need to transfer multiselect attribute values or other entities to Magento 2 regularly, use the Improved Import & Export extension. The module provides the ability to leverage the cron scheduler to plan future updates.

How to import multiselect attribute values to Magento 2 from external systems?

With the Improved Import & Export Magento 2 extension, you can transfer multiselect attribute values not only between two Magento 2 stores but also from external systems. Unlike the default Magento 2 import solution that prevents transfers of third-party data, our module provides the ability to create a mapping scheme and match any external attributes to the default ones used in Magento 2. Furthermore, the extension provides the ability to match attribute values including multiselect attribute values. As a result, you can effortlessly adapt any external data to the native Magento 2 standards.

How to import multiselect attribute values to Magento 2 via API?

By default, Magento 2 neither lets you import multiselect attribute values nor transfer other entities via API. But you can use the Improved Import & Export extension to transfer the desired entities to Magento 2 via API.

How to import multiselect attribute values to Magento 2 via ODS files?

If you store multiselect attribute values in an ODS file, the Improved Import & Export Magento 2 extension will help you transfer them to your e-commerce website. While Magento 2 works with CSV files only, our module exceeds the existing limitations by adding support for other file formats.

How to import multiselect attribute values to Magento 2 via XLSX files?

If you store multiselect attribute values in an XLSX file, the Improved Import & Export Magento 2 extension will help you transfer them to your e-commerce website. While Magento 2 works with CSV files only, our module exceeds the existing limitations by adding support for other file formats.

How to import multiselect attribute values to Magento 2 via JSON files?

If you store multiselect attribute values in a JSON file, the Improved Import & Export Magento 2 extension will help you transfer them to your e-commerce website. While Magento 2 works with CSV files only, our module exceeds the existing limitations by adding support for other file formats.

How to import multiselect attribute values to Magento 2 via compressed files?

If multiselect attribute values are stored in an archive, you can also use Improved Import & Export to transfer them to Magento 2. Note that it should be a ZIP or TAR archive that contains a CSV, XML, ODS, XLSX, or JSON file.

How to import multiselect attribute values to Magento 2 from Google Sheets?

If your attribute values are stored in Google Sheets. It is no longer a problem: use the Improved Import & Export extension to import multiselect attribute values to Magento 2 from Google Sheets. You need to specify the corresponding table as your import source, providing its URL.

How to import multiselect attribute values to Magento 2 from Dropbox?

Along with Google Sheets and other file sources, the Improved Import & Export extension lets you transfer multiselect attribute values to Magento 2 from Dropbox. The requirements are simple: store your data in CSV, XML, ODS, XLSX, or JSON files. If they are compressed, they should be in either ZIP or TAR format.

How to import multiselect attribute values to Magento 2 from Google Drive?

Along with Dropbox and other file sources, the Improved Import & Export extension lets you transfer multiselect attribute values to Magento 2 from Dropbox. The requirements are simple: store your data in CSV, XML, ODS, XLSX, or JSON files. If they are compressed, they should be in either ZIP or TAR format.

How to use product import to mass update attributes in Magento 2?

You can explore community forums discovering various techniques that let you mass update attributes in Magento 2 by transferring products. However, the Improved Import & Export extension lets you update multiselect attribute values by transferring product attributes only. Update multiple attributes and attribute values in bulk and apply any changes your business requires. Note that the plugin lets you specify product attributes as your import entity and choose the add/update import job behavior.

How to import csv with several attributes to Magento?

With the Improved Import & Export module, you get the ability to transfer a CSV file with several attributes to Magento 2. Also, you can import XML, XLSX, ODS, and JSON files. And as we’ve just mentioned above, you can import multiselect attribute values from Google Sheets or via API.

How to remove attribute multiselect values on catalog import to Magento 2?

It is possible to delete attribute multiselect values during the Magento 2 import by adding the option:delete_values to your import table. Specify the attribute values you want to remove in this column. The attribute itself stays untouched. For instance, the column lets you remove green, red, yellow, or other similar values for the attribute ‘color’.

How to export product attributes and attribute multiselect values in Magento 2?

You can also use the Improved Import & Export extension to export attributes along with multiselect attribute values from Magento 2. You only need to create a new export job where you choose the corresponding export entity and configure other transfer parameters.

Final Words

The Improved Import & Export Magento 2 extension lets you add multiselect attribute values without any new line of code. You just need to install the module to leverage its functionality. In addition to the ability to import and export entities that are not supported in Magento 2 by default, it also offers a bunch of robust improvements. Thus, you can entirely automate data transfers between your e-commerce website and external platforms with the help of schedules. 

The extension also lets you replace unsupported attributes and attribute values most easily. You can leverage either mapping presets or a matching interface. At the same time, several features are aimed at more efficient attribute value editing. And you can create lacking attributes on the fly. 

With the help of extended connectivity options, the Improved Import & Export Magento 2 plugin also lets you move updates via API or from Google Sheets, avoiding standard data file transfers. And as we’ve just mentioned, you are no longer limited to the CSV standard and direct uploads. For further information on how to add multiselect attribute values via CSV, follow the link below or contact our support:

Get Improved Import & Export Magento 2 Extension