I'm using Magento 2.1.2
Since I'm not so good with php language, I would like to know if exists any way to update quantities in my catalog reading a file with 2 columns
SKU | Qty
889588... 3
and do a query like this
UPDATE table_stock SET qty = x WHERE sku = y
If the qty is 0 the product has to be out of stock.
My Idea is to create a php file and update it on the root of magento installation on the server, and run it calling it's path.
Best Answer
I've written the following script to achieve what you asked for. I suggest placing this outside your root Magento directory inside a scripts folder so this is not accessible by browser.
Create file in suggested directory:
/var/www/html/magento/scripts/update-low-qty.php
. Add the following:Then run this script by command line by running
php update-low-qty.php
.To configure which product sku's get updated and what they get updated to, add to the products array which is in the format of
product_sku => quantity_to
.Expected output: