cancel
Showing results for 
Search instead for 
Did you mean: 

Stock not decreasing when not in stock

Stock not decreasing when not in stock

Hello

 

I re-wrote two functions out of this classes to allow to order a product which is not in stock and stock management is enabled:

Magento\CatalogInventory\Model\Quote\Item\QuantityValidator
Magento\CatalogInventory\Model\StockStateProvider

The quantity of a product like this is 0 - but now I'd like to decrease the count also if a order is placed.

 

How can I achieve that? Where is the code which handles this?

 

Regards

Patrick

2 REPLIES 2

Re: Stock not decreasing when not in stock

Hi @patrick_tschumi,

You can use magento default feature to use back order instead on customization.

https://docs.magento.com/m2/ce/user_guide/catalog/inventory-backorders.html

I hope it will help you!

Re: Stock not decreasing when not in stock

@patrick_tschumi  How about reducing the threshold for out of stock from 0 to -10 or something which can work for you? In this way your stock will reduce as well as you'll get the orders.

- Tarandeep
Problem solved?Please give 'Kudos' and accept 'Answer as Solution'.