Magento 2, Magento Development, Customization, Extension Development and Integration, Optimization, SEO and Responsive Design

Magento 2, Magento Development, Customization, Extension Development and Integration, Optimization, SEO and Responsive Design

Magento 2 Stock control issue in Cancelled/Failed order

I experience a problem with stock control in Magento 2. After placing an order, the inventory is reduced. However, when i cancel the payment, the qty is increased by 2. It looks like restoring the cart results in increasing the stocks, as well as canceling the order. So i think there is something wrong in magento's restore cart function.

You can remove the event that increases the stock on restoring a quote.
This will require an edit in a magento core file.

In: vendor/magento/module-catalog-inventory/etc/events.xml

remove:

<event name="restore_quote">
  <observer name="inventory" instance="Magento\CatalogInventory\Observer\RevertQuoteInventoryObserver"/>
</event>

Please support us, Like us on Facebook.

0 comments:

Post a Comment

 

Copyright @ 2017 HKBlog.