I don't want to decrease stock qty when order is placed. I know this can be done in admin by setting decrease stock to NO. But I want to change the update stock logic, so I need to know where can I programmatically stop decreasing stock qty in code.
1 Answer
By programmatically, set an observer to retain the quantity
after placing the order success. Refer this link to use observer Which observer to use after success order on Magento 2?
Edit
vendor/magento/module-catalog-inventory/Observer/SubtractQuoteInventoryObserver.php
Refer this file, It has the functionality to decrease quantity.
-
I tried "checkout_submit_all_after". but I can't see which function does Magento 2 use to decrease the stock qty. Dec 13, 2018 at 13:33
-
-
@MagentoLearner Are you able to stop decreasing qty ? I did in this way - magento.stackexchange.com/questions/317849/… but it is not working Jul 21, 2020 at 9:30
-
@VigneshBala I did in this way - magento.stackexchange.com/questions/317849/… but it is not working Jul 21, 2020 at 9:30