How to export custom SKU column from Magento 2 with all content

- E-Commerce, Magento 2

Magento 2 export CLI

Paras Sakariya has added a custom SKU column to a sales order grid. While the corresponding records appear on the backend side, no data is displayed in exported files. Let’s explore this case and provide possible resolutions. You can find more similar issues described in our Cookbook.

'

The Issue

Paras applies custom configuration to the sales order grid using the following code snippets:

  1. Package\Company\view\adminhtml\ui_component\sales_order_grid.xml

  2. Package\Company\Ui\Component\Listing\Column\Sku.php

As a result, he got the new SKU field that is visible on the order screen. However, when Paras tried to export the content of the grid, the respective column in a CSV file was empty. The following screenshot illustrates the unwanted result:

The Solution

According to Nirav Patel, the improperly implemented SKU column is a monkey on Sakariya’s back. Therefore, he recommends to apply the following changes:

  1. [vendor]/[module]/view/adminhtml/ui_component/sales_order_grid.xml

  2. [vendor]/[module]/etc/adminhtml/di.xml

After that, you can create a plugin file here: [vendor]/[module]/Plugin/Admin/Order/Grid.php

That’s it. In this particular case, the changes described above will help you export a custom SKU column from Magento 2 with all content. How about other similar issues?

Be more careful about what changes you apply. The smallest nuances usually impact unexpected areas of your Magento 2 website. Therefore, all changes should be well-thought and adequately tested. 

However, there is a robust data transfer solution that can be easily adjusted for any custom changes that you implement in your Magento 2 project. Let’s see what perks it delivers.

Reliable Alternative 

The Improved Import & Export extension lets you transfer data between a Magento 2 website of any complexity and external systems of your choice. The module introduces an entirely new level of synchronization compared to the default Magento tools and most third-party solutions. It dramatically enhances the default capabilities of the platform, delivering numerous features that are exclusively available in our plugin. 

The Improved Import & Export module enables you to export SKUs from your unique column within just a few clicks. You only need to discuss the customization with our team.  

Besides, the extension allows for automating data transfers in two different ways. First of all, Improved Import & Export lets you use a cron scheduler. It is possible to create custom timespans or choose among provided intervals.  At the same time, you can enable real-time transfer with the system of triggers and rules. 

For various attribute-related issues, the Improved Import & Export extension offers presets, which introduce the ability to match third-party designations to ones used in Magento 2 within just a few clicks. Moreover, you can apply the accordant changes manually in the extension’s interface. Keep in mind that this feature is also suitable for both attributes and their values. 

Another crucial enhancement that the Improved Import & Export module introduces is the ability to transfer a wide array of file transfers. While Magento works with  CSV files only, our plugin also supports XML, Excel, JSON, and ODS formats. Besides, it knows how to behave with ZIP and TAR archives. Numerous file sources are under your disposal, such as local and remote servers, cloud storage options, Google Sheets, APIs, etc. Many more features and opportunities associated with our extension are described here:

Get Improved Import & Export Magento 2 Extension

'