Magento CLI Commands: How to Run Product Import in Magento 2 from CLI
Welcome to our guide to Magento CLI commands. If you want to optimize your daily routine related to Magento 2 product import, you’ve come to the right place. Below, we shed light on several data transfer optimizations that will help you save tons of time spent on daily chores. Many merchants look for tips on importing products to Magento 2 using the command line interface. Below, you will find the easiest way to do so.
The following article is based on the
Table of contents
- 1 The StackExchange Approach to Magento CLI
- 2 The Improved Import Approach: Magento 2 CLI for Open Source
- 3 How to Run Product Import in Magento 2 from CLI
- 4 Magento CLI Import & Export FAQ
- 4.1 How to disable an import job via CLI in Magento 2?
- 4.2 How to enable an import job via CLI in Magento 2?
- 4.3 How to run an import job via CLI in Magento 2?
- 4.4 How to disable an export job via CLI in Magento 2?
- 4.5 How to enable an export job via CLI in Magento 2?
- 4.6 How to run an export job via CLI in Magento 2?
- 4.7 How to automate import and export processes in Magento 2?
- 4.8 How to import and export data with third-party attributes in Magento 2?
- 5 Final Words
The StackExchange Approach to Magento CLI
According to Khoa TruongDinh, using CLI most efficiently, you cannot import products to Magento 2. Instead, he proposes to set up the Scheduled Import for the Commerce version under System > Data Transfer > Scheduled Imports/Exports. You can read more about the feature here:
The Improved Import Approach: Magento 2 CLI for Open Source
If you’re using the Open Source version, you should rely on third-party modules, such as the Improved Import & Export Magento 2 extension.
Our module fully supports cron enabling you to create any custom schedule of updates. There is no need to use CLI commands since everything can be configured within the extension’s backend in the most user-friendly manner.
You need to know the standard cron syntax to create a custom update schedule. Alternatively, you can select one of the predefined time intervals to run the update. Besides, you can still run product import asynchronously in manual mode using the corresponding CLI commands.
How to Run Product Import in Magento 2 from CLI
The default import tools of Magento 2 don’t let you use CLI. As you might have guessed, Improved Import & Export solves this problem. The extension allows you enable, disable, and start export processes from the Magento 2 CLI interface. Run the following Magento CLI commands in the Magento 2 root folder:
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 |
Also, check the Magento 2 CLI commands list for export:
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 |
Note that you have to create corresponding jobs for both import and export processes before using these CLI commands.
Magento CLI Import & Export FAQ
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:COMMAND JOB_ID
import:job:disable
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:COMMAND JOB_ID
import:job:enable
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:COMMAND JOB_ID
import:job:run
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:COMMAND JOB_ID
export:job:disable
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:COMMAND JOB_ID
export:job:enable
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:COMMAND JOB_ID
export:job:run
How to automate import and export processes in Magento 2?
Use the Improved Import & Export Magento 2 extension to automate both import and export processes in Magento 2. The module provides a cron scheduler where you can configure the frequency of automated data transfers.
How to import and export data with third-party attributes in Magento 2?
The Improved Import & Export Magento 2 extension provides a user-friendly mapping interface, where you can match all unsupported attributes to ones used in Magento 2. As a result, any third-party data is automatically transformed during import processes and effortlessly transferred into Magento 2. Furthermore, the same tool is suitable for export, working in the opposite direction. In this case, you show what data to use to replace the default Magento 2 attributes, generating the output your partners require.
Final Words
We hope the article was useful and now you can easily master Magento CLI commands for product import and export. Check our Cookbook for other Magento 2 tips. For further information about the extension, contact us and follow this link:
Get Improved Import & Export Magento 2 Extension