If you want to export products from Magento 2 using the command-line interface, you’ve come to the right place. In the following material, we describe how to transfer data via CLI from your e-commerce website. You can find more tips on how to work with Magento 2 in our Cookbook.'
Table of contents
- 1 Export products from Magento 2 via CLI
- 2 Import products from Magento 2 via CLI
- 3 Other notable export enhancements
- 4 Final Words
Export products from Magento 2 via CLI
Unfortunately, you cannot export any data from Magento 2 via CLI using the platform’s native instruments. But there is a solution that offers the missing functionality. Meet the Improved Import Magento 2 extension. Although our module provides a very user-friendly backend interface, you can also rely on the command-line interface to run product export.
Or module offers flexible import and export jobs – highly configurable rules that can be scheduled by cron. You can run them right from the Magento 2 admin. Alternatively, it is possible to export products and other entities via CLI.
With the Improved Import & Export Magento 2 plugin, you can enable, disable, or start export processes from the Magento 2 CLI interface. You have to run the following commands in the Magento 2 root folder:
php -f bin/magento export:job:COMMAND JOB_ID
export:job:disable Disable Firebear Export Jobs
export:job:enable Enable Firebear Export Jobs
export:job:run Launch Firebear Export Jobs
Please, contact our support to get the latest command versions.
Import products from Magento 2 via CLI
Also, note that the default import tools of Magento 2 don’t let you use CLI. As you might have already guessed, Improved Import & Export solves this problem.
Use the following commands to import data to Magento 2 via CLI:
php -f bin/magento import:job:COMMAND JOB_ID
import:job:disable Disable Firebear Import Jobs
import:job:enable Enable Firebear Import Jobs
import:job:run Generate Firebear Import Jobs
Note that for both import and export processes, you have to create corresponding jobs. If there are no import or export profiles, there is nothing to control via the command-line interface.
Other notable export enhancements
In addition to the ability to import and export data from CLI, the Improved Import & Export module offers lots of other improvements. The extension provides several benefits that are not available with most similar plugins, not to mention the default Magento 2 tools. Our module can move all possible entities to and from your e-commerce website, automating this process.
Automated Import & Export
Improved Import & Export lets you automate export processes using schedules. At the same time, we are going to implement trigger-based data transfers.
With our module, you get the ability to leverage the default cron syntax to automated data transfer. It is only necessary to specify an interval to create a schedule. Next, the extension will launch a job automatically. You can either create custom intervals or choose predefined schedules. The gif below illustrates the process:
As for event-based transfers, they are associated with real-time integrations. The module lets you select a trigger linked to a specific event that launches a data transfer after the event takes place. For instance, you create a new product in the admin. If this action is connected to a trigger, the extension will launch a corresponding action, for example, product export. Check this article for more detail: How to Run Magento 2 Import or Export After Specific System Event or Process.
The Improved Import & Export extension offers a bunch of mapping features that simplify both import and export processes. Let’s explore ones related to export processes.
Our module offers mapping presets developed to simplify various integrations. It lets you use the predefined schemes to replace Magento 2 attributes with third-party attributes required by your export destination. You only need to choose a preset developed for your platforms. Next, our module will do all the work for you. The process looks as follows:
If you cannot find the necessary present or want to do everything manually, the Improved Import & Export Magento 2 module offers a matching interface. Thus, you can map attributes right in the Magento 2 admin. You only need to choose an entity, select a third-party attribute and specify a replacement:
Our extension offers filters that simplify your product export routine. The feature lets you narrow down the selection of data in an exported file. To enable the feature, select an entity and a system attribute. Next, choose filtering parameters. That’s it!
Attribute Values Mapping & Editing
You can also simplify both import and export processes with the ability to map and edit attribute values right in your Magento 2 admin. Our extension offers an interface similar to the one described above. It means that the necessity to edit attribute values in data files is eliminated. Select a third-party designation and specify a replacement instead of performing dozens of searches and edits. Read this article for more information: Attribute Values Mapping.
As for editing attribute values in bulk, it is another useful feature that is not available by default. With our plugin, you can add a prefix/suffix to multiple attribute values. Another rule lets you split or merge them. All these actions can be applied simultaneously. Follow this link to discover more facts: How to Modify Attribute Values During Import and Export in Magento 2.
Extended Connectivity Options
Now, let’s say a few more words about the advanced functionality of the Improved Import & Export module related to its unique connectivity options.
Multiple File Standards & Sources
The default Magento 2 data transfer tools let you export only CSV files. The Improved Import & Export plugin eliminates this limitation, providing support for XML, JSON, ODS, and Excel standards. As a result, you can export products in a file required by an external platform. When it comes to importing data, our extension also knows how to unzip compressed data automatically.
Note that the Improved Import & Export Magento 2 module works with numerous file sources: FTP/SFTP, Dropbox, direct URL uploads, etc.
Alternative Ways of Import & Export
And file transfers are no longer the only way to move data between your e-commerce store and other systems! The Improved Import & Export module exceeds the existing boundaries by enabling direct REST API connections as well as leveraging SOAP and GraphQL standards to transfer data.
As for support for intermediary services, it includes Google Sheet, Office 365 Excel, and Zoho Sheet. While API connections work in both directions, intermediary services are suitable for import processes. Below, you can see how to import products from Google Sheet:
Since it is not possible to export products via CLI using the default Magento 2 data transfer tools, we recommend you to use the Improved Import & Export Magento 2 extension as a reliable replacement. This module not only enables the missing feature but also adds tons of possibilities: automated transfers, mapping, additional data standards and sources, etc. For further information, follow the link below:'