Magento CLI Guide: How to Export Products from Magento 2 via CLI
Although most Magento 2 administrators prefer working with their e-commerce website strength in the admin area, there are still many people who require the same management opportunities to be implemented with the command line interface. However, the default data transfer solutions of Magento 2 don’t support Magento CLI commands. Both import and export tools are enough for basic purposes only. If you want to export products from Magento 2 via CLI, you need a third-party solution. In the following material, we describe how to transfer data via CLI from your e-commerce website with the help of Improved Import & Export. Besides, we shed light upon the corresponding data import processes based on the Magento 2 CLI commands. Follow these steps to export Magento 2 products with CLI commands.
Table of contents
- 1 Install Improved Import & Export
- 2 Create Product Export Job
- 3 Export products from Magento 2 via CLI
- 4 Magento 2 CLI Commands for Import
- 5 Final Words
- 6 Magento 2 CLI Import & Export FAQ
- 6.1 How to disable an export job via CLI in Magento 2?
- 6.2 How to enable an export job via CLI in Magento 2?
- 6.3 How to run an export job via CLI in Magento 2?
- 6.4 How to disable an import job via CLI in Magento 2?
- 6.5 How to enable an import job via CLI in Magento 2?
- 6.6 How to run an import job via CLI in Magento 2?
Install Improved Import & Export
First of all, you need to install the Improved Import & Export Magento 2 extension. Note that our specialists can help you do that. Contact our support for more information.
Get Improved Import & Export Magento 2 Extension
Also, you can find a detailed description of how to install our module here: Improved Import & Export Manual.
Create Product Export Job
Now, you need to proceed to System -> Improved Import / Export -> Export Jobs and hit the Add New Job button. Next, follow these instructions: How to Add a New Export Job.
Export products from Magento 2 via CLI
Now, you can export products from Magento 2 via CLI.
Magento CLI Commands: Export
The Improved Import & Export Magento 2 plugin lets you 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:
1 2 3 4 5 |
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 |
Magento 2 Product Export CLI Command
Now, use this command to export products from Magento 2:
php -f bin/magento export:job:run
Note that if you don’t specify a job ID, this will launch all export jobs.
You will see the following information in the terminal (the ID is specified):
Please, contact our support to get the latest command versions.
Magento 2 CLI Commands for Import
Use the following commands to import data to Magento 2 via CLI:
1 2 3 4 5 |
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.
Final Words
Since it is impossible to export products via CLI using the default Magento 2 data transfer tools, we recommend using the Improved Import & Export Magento 2 extension as a reliable replacement. This module enables the missing feature and adds tons of possibilities: automated transfers, mapping, additional data standards and sources, etc. For further information about the Magento CLI and other features, follow the link below:
Get Improved Import & Export Magento 2 Extension
Magento 2 CLI Import & Export FAQ
Below, you can find the same information that we’ve just provided above in the form of questions and answers.
How to disable an export job via CLI in Magento 2?
Use the following command to disable an export job in Magento 2 via CLI:
php -f bin/magento export:job:disable JOB_ID
How to enable an export job via CLI in Magento 2?
Use the following command to enable an export job in Magento 2 via CLI:
php -f bin/magento export:job:enable JOB_ID
How to run an export job via CLI in Magento 2?
Use the following command to run an export job in Magento 2 via CLI:
php -f bin/magento export:job:run JOB_ID
How to disable an import job via CLI in Magento 2?
Use the following command to disable an import job in Magento 2 via CLI:
php -f bin/magento import:job:disable JOB_ID
How to enable an import job via CLI in Magento 2?
Use the following command to enable an import job in Magento 2 via CLI:
php -f bin/magento import:job:enable JOB_ID
How to run an import job via CLI in Magento 2?
Use the following command to run an import job in Magento 2 via CLI:
php -f bin/magento import:job:run JOB_ID