Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically stop decreasing stock qty while placing an order in magento

Tags:

magento

I would need to stop decreasing inventory while placing an order, I need to do this activity only after successful payment.

like image 811
Bijeesh K G Avatar asked Sep 17 '12 13:09

Bijeesh K G


1 Answers

Yes, We can disable this qty decrease pragmatically

How ?

Extend Mage_Checkout_Model_Type_Onepage and Rewrite the method saveOrder

Changes

before the following lines in the above method, will be around #740 to #742

    $service = Mage::getModel('sales/service_quote', $this->getQuote());
    $service->submitAll();

Add

    $quote = $this->getQuote();
    # Ref: Mage_CatalogInventory_Model_Observer::subtractQuoteInventory
    $quote->setInventoryProcessed(true);

This will inform Magento that dont process inventory for the quote, so it wont decrease the qty even if it is configured to do so.

like image 152
Manaf P M Avatar answered Sep 17 '22 17:09

Manaf P M