Overview
As you know our Magento1 version of the script “Updating product prices in Magento in an easier & faster way” was a massive hit. And we are back with a similar script for Magento 2 which helps you to update the product prices in bulk – probably the easiest and fastest way possible.
Let’s take a look at the standalone PHP script & sample CSV file below:
How to run the script?
1. Prepare the Script
Copy/Paste the script from above to the file: [magento2-root]/pub/m2-import-prices-index.php
2. Prepare the CSV Data
Download the sample CSV file as “prices.csv” and update values for SKU & Price columns. Then upload the CSV file to the [magento2-root]/var/import/ directory.
3. Run the Script
You can run script either from browser or from CLI.
3.1 Executing the price bulk update from Browser
Go to the browser and hit the URL:
http://[magento2-base-url]/m2-import-prices-index.php
Which will out as below on successful operation:
Note: If you are using Nginx web server and want to change the script filename other than *-index.php, you may need to edit the nginx.conf.sample file of Magento2 as
# PHP entry point for main application
location ~ (index|get|static|report|404|503|AddYourNewFileNameHere)\.php$ {
And of course need to reload the nginx configuration thereafter:
# Ubuntu
sudo service nginx reload
3.2 Executing the price bulk update script from CLI
Simply run the following command(s) from the Console of your server:
cd /path/to/magento2-root
php -f pub/m2-import-prices-index.php
Which will output as:
Note: This is recommended approach if you want to bulk update CSV data is big.
Hope Magento2 Developers & Store Owners will find this script useful.
Please do show your love towards the script by sharing & commenting below.
ANNOUNCEMENT
We have released the fastest price importer extension for Magento 2 for updating any kinds of prices (regular, cost, MSRP/MAP, special, tier & customer group price) via different methods (web, CLI & cron jobs)