Magento 2 export CLI

We continue sifting the endless StackExchange desert in an attempt to discover the most helpful discussion. This time, our attention has been captured by an export-related issue. Transferring customer data from Magento 2 has never been a problem. Unless you change something. In this StackExchange discussion, the author created a custom attribute before moving prospect data from the website. However, the default export tool failed to satisfy the designated business requirements. 

Below, we shed light on how to fix the problem and export customers with custom attributes in Magento 2. We provide the solution from the StackExchange discussion. You will find a method that helped its author export customers with custom attributes from Magento 2. Note that it requires coding experience to be implemented. Thus, non-technical users won’t be able to satisfy similar business goals with this approach. Therefore, we also deliver an absolutely different way of transferring any custom buyer data from Magento 2 based on the Improved Import & Export module. The tool lets you work with any custom attributes and also delivers numerous other features that simplify data transfer processes.

Table of contents

The Issue

Chirag Patel had to create a custom attribute for Magento 2 customers. He named it “Approve Account” and tried to export customers using the default Magento 2 export tool. However, the standard procedure caused a fatal error. You can see its full text below:

The attribute has this representation under /app/code/Namespace/Module/view/adminhtml/ui_component/customer_listing.xml

Under /app/code/Namespace/Module/setup/installData.php, the corresponding records look as follows:

What Developers Say

Let’s take a look at what other Magento 2 coders think about the problem. According to Dhiren Vasoya, you need to create YES/NO options for customers using a boolean attribute. But Chirag Patel says that it doesn’t solve the problem of exporting customers with custom attributes from Magento 2. The question is still unanswered. 

The Solution

Sanjay Chaudhary recommends trying the below code with the static datatype. He also points to the following consequences: 

Although a static datatype in the custom attribute above solves the problem in the grid export, it may throw an error during reindexing since the attribute type is static. The system looks into the customer_entity table for the specific field but it is not available there. So how to export customers with custom attributes in Magento 2 with no errors?

In Chirag Patel’s case, it is necessary to create a field in the customer_entity table. The new custom attribute should be represented there. Also, Sanjay Chaudhary recommends checking the customer_listing layout in the ui_component directory: you should not place the corresponding records about the attribute there. 

Also, avoid adding the field in indexer.xml. Note that it automatically updates data in the customer_grid_flat table.

All these steps look quite confusing and complicated if you’ve never worked with custom attributes. Moreover, a non-technical user won’t solve this issue. So, is there another way to export customers with custom attributes from Magento 2 without errors?

The Alternative Way

The Magento 2 ecosystem is extremely huge. Its market of extensions is so big that you can find literally everything there. For instance, we described how to enhance the Open Source website with Commerce Features here: Magento 2 Heterogeneity. What about exporting customers with custom attributes? 

Although dozens of export tools are available on the Magento Marketplace, there is one solution that’s worth your attention. Meet the Improved Import & Export module. This tool not only can cope with any custom attribute but also simplifies data transfer processes with numerous features.

For instance, you can entirely automate customer export with the help of cron-based schedules. The module offers predefined intervals and lets you customize them. 

At the same time, it delivers numerous mapping features so that you can not only export your custom attributes but also modify them according to the requirements of the connected platform.

Multiple file formats and sources are under your disposal too. While Magento 2 lets you export customers in a CSV file, the Improved Import & Export extension provides the ability to create a JSON or ODS document. It also enables API data transfers for moving data between the two systems directly. 

And don’t forget that the extension works in two directions. It is not only an export solution but also a reliable import tool that lets you integrate Magento 2 with any external system. 

Send us a message to get more information about the module or follow this link to get your copy:

Get Improved Import & Export Magento 2 Extension

Magento 2 Customer Import FAQ

Let’s take a look at other nuances of importing and exporting customer data with custom attributes in Magento 2  with the help of the Improved Import & Export Magento 2 extension.

How to import and export customers with custom attributes to Magento 2 automatically?

If you need to transfer custom customer attributes to or from Magento 2 on a regular basis, it is necessary to install a third-party tool. Unfortunately, the default import/export solutions don’t let you create import jobs that run on schedule. Therefore, we recommend you use the Improved Import & Export extension to import customers with custom attributes to Magento 2 automatically. The extension leverages cron so that you can create a schedule of updates. Next, the module does everything for you importing and exporting data at a specified time.

How to import and export customers with custom attributes to Magento 2 from external systems?

While the default Magento 2 import mechanisms block the import of third-party data that doesn’t follow the system’s requirements, you can use the Improved Import & Export extension to circumvent these restrictions. The module lets you create a mapping scheme matching any external values to the default Magento 2 attributes. Consequently, any external data is easily adapted to the native standards of your e-commerce website. The most intriguing aspect is that you do everything right in your admin. It is also possible to apply mapping to export processes to generate the output your partners require. Thus, the Improved Import & Export extension lets you freely transfer customers with custom attributes from your website.

How to import and export customers with custom attributes to Magento 2 via API?

You need to use the Improved Import & Export Magento 2 extension to import customers with custom attributes to Magento 2 via API. Our extension lets you create the connection between the two systems transferring any data, including customers with custom attributes. Any import job provides an interface where you can specify the parameters necessary to put the two systems together. Note that it is possible to create a bi-directional API connection with our module.

How to import and export customers with custom attributes to Magento 2 via ODS files?

If the custom customer data is stored in an ODS file, you no longer need to convert it to a CSV file to fit the Magento 2 requirements. With the Improved Import & Export Magento 2 extension, it is possible to import ODS files to your ecommerce website without any necessity to run the conversion. You can also export customers with custom attributes using this file format.

How to import and export customers with custom attributes to Magento 2 via XLSX files?

If the custom customer data is stored in an XLSX file, you no longer need to convert it to a CSV file to fit the Magento 2 requirements. With the Improved Import & Export Magento 2 extension, it is possible to import XLSX files to your ecommerce website without any necessity to run the conversion. You can also export customers with custom attributes using this file format.

How to import and export customers with custom attributes to Magento 2 via JSON files?

If the custom customer data is stored in an ODS file, you no longer need to convert it to a CSV file to fit the Magento 2 requirements. With the Improved Import & Export Magento 2 extension, it is possible to import JSON files to your ecommerce website without any necessity to run the conversion. You can also export customers with custom attributes using this file format.

How to import customers with custom attributes to Magento 2 via compressed files?

If the custom customer data is stored in a compressed file, you can also transfer it to Magento 2 with the help of the Improved Import & Export extension. However, there are two requirements to follow. Firstly, your file archive should be in a ZIP or TAR format. Secondly, the compressed data should be stored in a CSV, XML, ODS, XLSX, or JSON file.

How to import customers with custom attributes to Magento 2 from Google Sheets?

If your customers with custom attributes are stored in Google Sheets, it is no longer a problem. There is no need to export it from the service and then transfer the output to Magento 2. The Improved Import & Export lets you move the corresponding information straight from Google Sheets to your e-commerce website. It is only necessary to specify the address of the corresponding data table.

How to import and export customers with custom attributes to Magento 2 from Dropbox?

In addition to Google Sheets, the Improved Import & Export module lets you transfer customers with custom attributes to Magento 2 from Dropbox. Your data should be stored in CSV, XML, ODS, XLSX, or JSON. If it is a compressed file, it should be in a ZIP or TAR format. You can use this file storage as your export destination.

How to import and export customers with custom attributes to Magento 2 from Google Drive?

In addition to Google Sheets and Dropbox, the Improved Import & Export module lets you transfer customers with custom attributes to Magento 2 from Google Drive. Your data should be stored in CSV, XML, ODS, XLSX, or JSON. If it is a compressed file, it should be in a ZIP or TAR format. You can use this file storage as your export destination.

Similar Posts