lechowski / 13.11.2021

Update product Stock with 0 quantity when import with CSV

Update products with 0 stock when Import via CSV

In many cases CSV want to update the stock of products by the importer PrestaShop. The problem usually arises when we want to update products or combinations with the value "0". PrestaShop prevents actualizemos amounts to "0", so we have to resort to a modification to update us products with the value of stock.

We'll have to open the "controllers/admin/AdminImportController.php" file

Seek public function productImport function (), and within it, this line

and eliminate the section "&& (int) $ product-> quantity"

With this we can update products with stock 0 from our CSV

But if we update product combinations, we need to modify another line in the same file. Within the attributeImport (function), we seek:

and replaced by:


With this, we should update products with stock "0".

We can also create an override of the class AdminImportController.php not lose it when you upgrade.