How to fix store ID-related issues on Magento 2 import

- E-Commerce, Magento 2

Magento 2 export CLI

Jackson complains about store ID-related issues that occur in Magento 2. Let’s take a look at the problem and provide several possible solutions. More useful tips are available in our Cookbook.

'

The Issue 

Jackson points to the script mentioned in this discussion. He imports data from a CSV file with its help. However, when the author uses ->setStoreId(0), two values for the same field in the database table occur – Store Id 0 & Store Id 1.

Therefore, you always need to delete Store Id 1 corresponding values from the corresponding database table to enable changes on the frontend. However, the data is not displayed correctly. Jackson argues that he has to delete queries for the corresponding store ID in 5-6 tables.

As for the default Magento 2 import/export solution, it relies on Store Id 0 as expected, so everything works properly.

The Solution

Sébastien Trottier offers the following way to address the problem:

He insists on the necessity to use store id 0 (‘admin’) only for products before importing them.

From the above snippet, Sébastien concludes that the store id is retrieved from the current store on save, but not the one specifies via Product::setStoreId():

That’s the root of all evil.

Reliable Alternative 

You can import and export products and all other entities between Magento 2 and any systems with the help of Improved Import & Export. The extension dramatically enhanced the default capabilities of the platform and delivers numerous features that are not available in other third-party data transfer tools. 

Of course, it has no store ID-related issues. You seamlessly transfer data to your e-commerce store if it complies with the existing requirements. If not, you can modify it within just a few clicks due to the extensive functionality of the Improved Import & Export module. Thus, you prevent possible issues before they occur.  

Besides, our tool lets you automate data transfers in several ways. Firstly, you can rely on cron-based schedules: either predefined or custom. Secondly, there is a system of triggers for real-time transfers. 

If you face attribute-related issues, the Improved Import & Export extension is under your disposal too. The module lets you match third-party designations to ones used in Magento 2. You can do that automatically; applying presets – preconfigured matching schemes aimed at particular integrations. Alternatively, it is possible to do that by your own hands right in your Magento 2 admin. The same functionality covers not only attributes but also their values and several other aspects of import processes. 

Of course, the Improved Import & Export module lets you transfer not only CSV but also XML, Excel, JSON, and ODS files. It knows how to unpack ZIP and TAR archives. You can rely on numerous file sources to move data. For example, our extension supports local and remote servers, cloud storage options, Google Sheets, etc. As for complex integrations, they can be based on APIs. For more information, follow this link:

Get Improved Import & Export Magento 2 Extension

'