2

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.

2
  • have you tried so far?
    – Amit Bera
    Jul 27, 2016 at 10:48
  • I am trying to find the controller/model that decreases the value, but I am unable to find it. By the way, plan is to override that particular file and then create custom event to fire an observer for that order status change and then in that observer , decrease the quantity. Jul 27, 2016 at 10:51

1 Answer 1

2

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

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.