Invalid Option Value: How To Fix Magento 2 Import Error

- E-Commerce, Magento 2, Our extensions

Magento 2 Development; Magento 2 tutorial

Below, we explore a problem that prevents Magento 2 import. The Invalid Option Value Error may occur when you import a configurable product with many options. Below, we study two cases and provide several resolutions to the issue. Besides, you will find out how to increase the efficiency of every import procedure.

‘Invalid Option Value’ Error Case Study

Let’s take a look at two separate cases discussed on StackExchange. Both illustrate the same issue.

Case 1

William Oakley describes his experience with the ‘Invalid Option Value’ error here: Magento 2 Cannot save product (Invalid option value). He cannot save any changes in the configurable product due to the error. He assumes that the root of the problem is the custom options of his configurable product.

Case 2

In his turn, Duy Luân stuck at importing a configurable product from a CSV file. He posts about the problem here: Magento 2 – Importing Configurable Products problem.
The SKU of his configurable product is 10100033. It links two simple products with the following SKUs correspondingly: 10100033_Mercedes_Sprinter and 10100033_VW_Crafter.

But the import process leads to a situation when the Catalog shows that two of the three imported products are wrong. The attribute order is wrong as well. Let’s try to figure out how to avoid both inconveniences.

‘Invalid Option Value’ Error Resolution

Below, we discuss three ways of preventing both issues. First of all, let’s take a look at what other StackExchange users think about the problem.

StackExchange

Zeeshan Khuwaja says that Magento adds pagination for a product with more than 20 values. The corresponding element is available below on the right:

Note that to save such a product, you have to go through every page of its custom options. Here is a little technical explanation. Since Magento uses dynamic rows to load this behavior, the input fields are not added to HTML if you don’t open the remaining pages (2nd,3rd, etc.). Consequently, when you save the product, the options aren’t in the POST values.

Since Magento is checking if the values are equal in the POST, it considers that they aren’t because they are not available in HTML. To fix the problem, go through every page of every custom option and then save it.

Firebear

What do we think about the problem? In most cases, the ‘Invalid Option Value’ error during the Magento 2 import is caused by incorrect attribute values or problems with the product configuration. Thus, we recommend you to look through the specific configurable product attributes and double check them:

  • configurable_variations – this attribute describes values associated with a product variation. The value has the following format:
    sku={{SKU_VALUE}},attribute1={{VALUE}},attribute2={{VALUE}},default=1/0| For example: sku=sku-red xs,color=red,size=xs,price=10.99. Note that values are separated by a comma, multiple SKU values – by |. Where:

    • sku – SKU of a simple product assigned to the configurable one;
    • attribute 1 and 2 – values of the simple product attributes that are used to create configurable product variations, e.g., size, color.
    • default – defines the pre-selected variation for a customer who visits the configurable product page. To enable this feature, you have to install the Improved Configurable Products Magento 2 extension.
  • configurable_variation_labels – labels used for identifying product variations – name attributes for the frontend. For instance, for color=Choose color and size=Choose size, you set the attribute label ‘color’ to ‘Choose color’ and ‘size’ – to ‘Choose size.’ The values are separated by a comma.
  • associated_skus – this attribute identifies SKUs of individual products gathered in a group. This attribute is used to associate a simple product with Configurable and Bundle parents. Note that SKUs must be separated by a comma.

For further information about configurable product attributes and the dedicated import procedure, check the following article: The Complete Guide to Magento 2 Configurable Products, and how to import them

Improved Import

Magento 2 mysql data import

Here at Firebear, we were always dissatisfied with the quality of the default Magento import and export tools. Even after the release of the second version with all its revolutionary improvements, the default data transfer mechanisms were not as powerful as we needed.  And the recent 2.3 update didn’t help.

Luckily, we’ve decided to improve the whole ecosystem in the era of 1.x. The imperfection of Magento motivated us to replace its import and export solution with our own tool, so meet the Improved Import & Export Magento 2 extension – the latest version of our product that has become a number one time saver regarding data transfers of all kind for hundreds Magento users all over the world.

And the extension represents an enhancement to the import process of configurable products, making the procedure more straightforward and reducing the time necessary to import products to your Magento 2 catalog.

The core features of the Improved Import & Export extension that will help you import configurable products are:

  • Full support for Google Sheets – export products, categories and other directly from the popular service;
  • Import and export job scheduling – automate import and export processes;
  • Multiple file formats – take advantage of any file format without converting the import table into CSV;
  • Configurable product attributes can be created on the fly – update existing products and create new product attributes while importing products;
  • Attribute mapping – you can map your table structure and column names to match external attributes to the ones used internally;
  • Multiple entities – import and export anything you need from your Magento 2 store.
  • Price adjustments – increase or decrease the price of the imported products by a fixed or percent value and round the prices to .49 or .99.

Get Improved Import & Export Magento 2 Extension

Improved Import & Export Features

Magento 2 oracle import

Let’s describe the features mentioned above in more detail. Since the Improved Import & Export extension is designed to turn your Magento 2 admin into a central hub where you control all integrations, importing configurable products is not a problem for it.

The tool provides several ways of transferring data to your e-commerce website including a direct connection. And as a store admin, you get an opportunity to manage all integrations right in your backend. Furthermore, the plugin allows automating all import and export processes.

Automated Import & Export Processes

The Improved Import & Export Magento 2 extension provides the ability to leverage two different ways of automated data transfers: schedules and event-based triggers. The principle behind both mechanisms is quite simple: you configure the necessary options, and the plugin does everything for you.

Schedules

With the Improved Import & Export Magento 2 extension, you can use the default cron syntax to create update schedules. The module provides the ability to specify any custom intervals, creating a schedule suitable for your specific business conditions. At the same time, you can select one of the predefined intervals that are fully customizable as well. Select a value and change it in accordance with your business requirements.

Alternatively, it is possible to create import and export profiles which have no schedules. Although they are not very efficient for importing configurable products on a regular basis, it is possible to leverage unscheduled jobs for data migrations or asynchronous updates.

Another cool feature related to schedules is the ability to launch every profile manually even if it is automated. Due to asynchronous updates, you can avoid delays when a partner provides a file with configurable products after a scheduled update. With the Improved Import & Export Magento 2 extension, it is possible to transfer all updates into your database manually within just a few clicks. It is no longer necessary to wait for the next planned import event.

As for the configuration of a schedule, it looks as follows:

Events

The second way of automating data transfers is represented by event-based triggers. The Improved Import & Export extension enables real-time updates with their help. You have to create and configure a trigger specifying conditions to synchronize two systems right after a certain action takes place.

Let’s explore how to automate order export in real time. First of all, you have to assign an event to a trigger. In our situation, it is a newly placed order. If the module considers this event a trigger, it will launch an associated event (order export) right after a customer places an order. Thus, data is provided to an external system in real time.

The same approach can be applied to import processes. For further information, follow this link: How to Run Magento 2 Import or Export After Specific System Event or Process.

Advanced Mapping Features

In this chapter, we discuss another important aspect of the Improved Import & Export Magento 2 extension – mapping. Our module provides several exclusive features in this area which dramatically simplify every data transfer. There is no need to edit attributes and their values manually in a data file. Besides, our extension offers handy tools for matching categories and generating missing elements of a data file (even attributes for configurable products can be created on the fly). Once configured, a mapping scheme is saved and utilized for further updates. Let’s take a look at each feature separately.

Mapping Presets

The Improved Import & Export Magento 2 extension offers a very straightforward way of matching external attributes to ones used internally. The module provides mapping presets – a series of predefined mapping schemes that offer the ability to implement attribute matching in a few clicks only. Create a new import job, configure it, and choose a suitable preset in a mapping section. Next, the Improved Import & Export Magento 2 extension will do all the work for you.

Instead of looking for third-party attributes in a data file, you let our module analyze the input data that contains external attributes and match them to the internal designations. Thus, manual interaction with data files is eliminated. And as we’ve just mentioned, the procedure should be done only once since the selected preset is applied for further data transfers automatically. Here is how everything happens in the admin:

Matching Interface

If there is no preset suitable for your integration, utilize the matching interface of the Improved Import & Export Magento 2 extension. Yes, you have to map attributes manually but in your admin – not in a third-party editor. The procedure is fast and intuitive: select a third-party attribute and specify the corresponding internal one in front of it as shown below:

In the grid above, there is also the third column – “Default Value” –  where you can specify hardcoded (default) values – attribute values automatically provided to every item related to the attribute. It is handy when, for instance, you import configurable products from multiple store views to a single one.

Attribute Values Mapping

Besides, the Improved Import & Export Magento 2 extension provides the ability to match attribute values. Incorrect values may prevent import processes, so it is essential to replace all unsupported designations with the corresponding internal ones. In the case of the default Magento tools, you can do that only manually in a data file. Our plugin offers a better way of achieving this goal: you get an interface similar to the one we’ve just mentioned above. Thus, it is only necessary to choose a third-party designation and specify a corresponding internal one in front of it. Repeat matching values until no external designations are left. For further information, follow this link: Attribute Values Mapping.

Attribute Values Editing

In addition to the matching opportunities, the Improved Import & Export Magento 2 module lets you modify multiple attribute values simultaneously. The extension provides the following rules that can be combined and applied in bulk:

  • Add a prefix to multiple attribute values;
  • Add a suffix to multiple attribute values;
  • Split multiple attribute values;
  • Merge multiple attribute values.

Note that you can create various conditions to increase the efficiency of editing. For further information, follow this link: How to Modify Attribute Values During Import and Export in Magento 2.

Category Mapping

And you can freely map categories with the Improved Import & Export Magento 2 extension. The feature is especially useful in case of the configurable product import since you may transfer data from third-party catalogs that have own structure unsuitable to the one available on your website. Thus, you cannot freely import the update without editing third-party categories manually or applying changes after the data is transferred. But our plugin offers a more efficient way of doing that.

The Improved Import & Export extension allows matching external product categories to ones used internally much faster since you do everything in a single place of your admin – an import profile. The procedure of category mapping looks as follows:

In addition to mapping, it is also possible to create new categories on the fly. The Improved Import & Export Magento 2 extension lets you select a parent category and specify a new one, to which an imported configurable product will be assigned. Both catalog-related features are described here: Category Mapping.

Attributes On The Fly

Another opportunity useful when you import configurable products is the ability to create attributes on the fly. If an update file doesn’t contain all the necessary data, our extension lets you use the following general form to specify all parameters necessary to get all the missing elements automatically:

Attribute|attribute_property_name:attribute_property_value|…

The procedure is described in more detail here: Product attributes import.

Extended Connectivity Options

As mentioned above, you can dramatically extend the default opportunities related to the way how you move data into your store with the Improved Import & Export Magento 2 extension. Our module not only adds a bunch of new file formats but also enables several additional file sources as well as provides the ability to eliminate files from data transfers.

Multiple File Standards

While Magento is bound to CSV files only, the Improved Import & Export Magento 2 extension lets you use XML, JSON, ODS, and Excel files instead. As a result, there is no need to convert them to the only supported format before you want to import configurable products. And it is possible to apply all features described above to any of these file types.

Multiple File Sources

Another important improvement related to file transfers is support for multiple sources. The Improved Import & Export Magento 2 module lets you leverage several different connection options:

  • FTP/SFTP. Transfer configurable products using your local server or a remote one.
  • Dropbox. Use a Dropbox account to import/export configurable products.
  • URL. If you need to import configurable products, it is enough to specify their URL.

In case an updated file is compressed, you don’t need to extract it. The Improved Import & Export Magento 2 extension will do everything for you right during the import procedure unlike the default Magento import tool that cannot handle file archives.

Alternative Ways of Import & Export

As for alternative ways of importing configurable products, they are represented by API integrations and intermediary services. With the Improved Import & Export extension, you can connect your website to an external system via REST, SOAP, and GraphQL APIs.

API connections are more powerful and flexible than file transfers, so we use them for various complex integrations. Note that you can freely apply all the extension’s features described above to any API connection created with the help of the Improved Import & Export plugin.

As for intermediary services, our module lets you import configurable products from Google Sheets, Office 365 Excel, and Zoho Sheet. You can see the integration on the basis of Google Sheets below:

Magento 2 Google Sheet import

Watch the following video to see how the extension works:

Final Words

The ‘Invalid Option Value’ issue is not as dreadful as you might have thought. You can easily solve the problem manually without any coding skills or help of third-party specialists, importing configurable products without headaches. If you want to enhance the import workflow even more, try the Improved Import & Export extension. You can get the module here:

Get Improved Import & Export Magento 2 Extension

If you want to improve your interaction with configurable products, check this plugin:

Get Improved Configurable Products Magento 2 Extension