Question

In Magento 2.2.5 EE

Before placing order:
Product quantity = 1
stock status = 1

After placing order:
product quantity = 0
stock status = 0

After cancel order:
product quantity = 2
stock status = 1

I have check in my code, there is no order_cancel_after or sales_order_save_after or sales_order_state_change_before observer in any custom module.

Any idea what would be the issue?

Was it helpful?

Solution

I had checked these observers in my codebase:

  • order_cancel_after
  • sales_order_save_after
  • sales_order_state_change_before

I haven't found above observers in any of my custom/installed module.

But now I found the issue, there was an observer sales_order_save_before in a custom payment method, it was increasing quantity on order cancel. So, when I was canceling the order Magento increasing order quantity (Which is a default functionality) and also this observer (sales_order_save_before) was also increasing quantity.

That's way quantity was increasing twice.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top