Magento – Decrease stock when order status changes to processing

magento-1.9sales-order

I have a condition that I have to change/decrease the stock only when the order status changes to processing. By default it is changed as soon as order is placed. But, this is what I need to achieve.

Best Answer

First,read the question When does Magento decrement quantity

Let do some tricky code this requirement.

First,in order to stop decrement rewrite the Observer classMage_CatalogInventory_Model_Observer.

At this class add this code for revert the stock which just decrease.

$items = $this->_getProductsQty($quote->getAllItems());
Mage::getSingleton('cataloginventory/stock')->revertProductsSale($items);

Then using sales_order_save_after with checking order status process you can deducted the stock