Skip to content
Andrew J. Hill edited this page Nov 4, 2019 · 2 revisions

Disable Stock Reservation

In Magento 2.3 Inventory Management has been introduced which assumes responsibility for managing a stock reservation against multiple stock sources in expectation that it is the source of truth for inventory. Where Magento 2.3+ is implemented with an external OMS/WMS which are the source of truth for inventory (and likely don't allow for syncing reservations and stock levels) then there's a clear use case to allow multi source inventory but without stock reservations.

Magento's approach to multi source inventory and stock reservations is to leave the pre 2.3 implementatin of single source stock management in place and introduce 40+ new modules to handle the various aspects of MSI by implementing Plugin and Observers to override/replace this pre 2.3 functionality.

If you wish to disable all Inventory Management capabilities then is enough to disable all the new InventoryManagement modules (See - https://github.com/magento/inventory/issues/2269#issuecomment-528290256).

This module seeks to allow use of mutli source inventory without the complexity of handling stock reservations at all.

Approach

  1. Shortcut/disable the PlaceReservationsForSalesEventInterface with an around plugin
  2. Handle Order Lifecycle
    • On Placed
      • implement a plugin that replaces the AppendReservationsAfterOrderPlacementPlugin
        • checks saleability/availability as though doing the reservation (copy this inventory logic)
        • but instead deduct the stock
    • On Invoiced
      • do nothing
    • On Credit Memo
      • implement plugin to check if a return to stock is needed
    • On Cancelation
      • implement plugin to check if a return to stock is needed
        • because normal cancellation just compensates reservation (no stock would have moved)
    • On Ship
      • implement plugin to replace observer behaviour (Magento\InventoryShipping\Observer\SourceDeductionProcessor) and prevent a source deduction
Clone this wiki locally