Magento CLI Guide: How to Export Products from Magento 2 via CLI

- E-Commerce, Magento 2

Magento CLI: product export

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. 

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

magento cli: add 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:

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:

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