In version 2.3, Magento has finally added support for Multi Source Inventory (MSI). This is a fantastic feature that the community has wanted for years.
If you’ve used MSI before, you might have thought (as many of us did at Ampersand) that it’s a simple feature and should be relatively easy to implement; the catalogue inventory models even hint that support for it can be easily added. However this couldn’t be further from the truth! MSI is a complicated piece of work so we are glad that Magento has baked it into the core and provided official support for it.
There’s just one thing though…
Magento’s MSI comes bundled with a new feature called Stock Reservation.
What will this feature do?
- Place reservations for stock as customers place orders. The stock itself is not yet decremented at this stage
- In case of cancellations, the reservation is nulled by means of placing a negative value reservation
- When the order is shipped, the stock is then decreased from the inventory source, and a negative reservation is placed
- A cron job will clean up the reservations that are no longer needed, i.e the ones that have been nulled.
Essentially, this means that stock decrement happens at the point of shipment, as opposed to at the point of order, which is how Magento has typically done it in the past.
This feature in itself is very powerful, however you may argue that it does too much, as this logic would normally be found in a Warehouse Management System (WMS). If a WMS is being used to hold “the truth” about stock, this can create all sorts of data discrepancies and cause stock to oversell, or for some products to be seen as out of stock when really they are still in stock.
You can see more information about this problem in the github issue raised by the community: https://github.com/magento/inventory/issues/2269 – in particular, see these 2 comments for an example of the problem might manifest itself, and how a WMS would need to integrate with Magento to prevent it: https://github.com/magento/inventory/issues/2269#issuecomment-499479576 and https://github.com/magento/inventory/issues/2269#issuecomment-545339191
At the time of writing this article, Magento does not provide a way to turn off stock reservations, and they have recently closed the issue, suggesting that they might not provide this any time soon.
We want to keep the ability to use MSI in Magento and just disable the stock reservations feature. Luckily, Magento’s way of implementing features for MSI is very modern and has a clear distinction of responsibilities, so this is relatively simple to do.
You can see our module here: https://github.com/AmpersandHQ/magento2-disable-stock-reservation
It will essentially disable writes to the stock reservations table, as well as perform source detection and stock decrement at the time of order placement, instead of shipment.
We have yet to add the ability to refund stock to the right source, which we feel is a less important feature, as a typical WMS will handle stock replenishment outside of Magento.
Watch this space.
Backend development can get messy. But as a backend developer, it’s your job to ensure that the code you write is understandable and maintainable in […]
Thinking Operationally When retailers or ecommerce agencies think operationally they are looking to forge a connection between their technology and their business efficiency, or operational […]