Tutorial Magento 2 MSI - Multi-Source Inventory
Easy way to share how the Magento salable quantity and reservation are calculated!
I saw many merchants reporting the salable quantity below than the stock quantity as a bug, but it's not, it's a new feature that brings a better method to manage your stock, so I decided to bring this easy way to share how the Magento salable quantity and reservation are calculated.
To begin, consider the stock quantity as the physical stock and the salable quantity as the amount of the determination product that can be negotiated and is not involved in any order that has been processing.
Example
In this example, you will be able to see how does it work and understand better the salable quantity.
Initial Stock
Here we have two warehouses (France and Italy), in total, we have 15 products in stock and 15 salable products.
First Order
Our client bought 5 items of the same product.
Reservation Created
As 5 items were bought, these 5 items are reserved to be delivered. In this step, the stock option will be 15 and the salable quantity will be 10.
Items returned
Before invoicing the order there was the return of 3 items.
Reservation is updated
The salable quantity is a sum of all reservations made to a product, so the salable amount will be the quantity in stock 15 less the sum of the reservation rows (-5 + 3), the salable will be 13.
Shipping items
When you do the ship of the order that contains 2 items, the indexer will request the reindex of the Inventory index (MSI).
New reservation update
A new reservation line is added adding the number of items shipped. At this point, the salable quantity will be the same as the stock quantity.
The reservation is concluded when you don't need to reserve items in your stock to be delivered since they are not with you anymore. The sum of all reservations of this product results equal to 0, so it's completed
New reservation update - Magento MSI - Salable Quantity Calculation and Mechanism of Reservations
Reservation cleaning
After completed, for default the reservation cleaning runs once a day and removes all the reservations from the database that the sum of them per SKU results equal 0, in other words, remove the reservations of the items that were shipped.
Salable equal stock quantity
We don't have reservations to calculate anymore, the products were shipped and the salable and the stock amount will be the same again, but now 13 items.
Thank you!
Thank you for reading, I hope this be helpful for you if it was let me know in the comments below.
Reference: Salable Quantity Calculation and Mechanism of Reservations Algorithm