DEV Community

Cover image for Tutorial Magento 2 MSI - Multi-Source Inventory
Rafael Corrêa Gomes
Rafael Corrêa Gomes

Posted on • Updated on • Originally published at linkedin.com

Tutorial Magento 2 MSI - Multi-Source Inventory

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.

Initial Stock - Magento MSI - Salable Quantity Calculation and Mechanism of Reservations

First Order

Our client bought 5 items of the same product.

First Order - Magento MSI - Salable Quantity Calculation and Mechanism of Reservations

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.

Reservation Created - Magento MSI - Salable Quantity Calculation and Mechanism of Reservations

Items returned

Before invoicing the order there was the return of 3 items.

Items returned - Magento MSI - Salable Quantity Calculation and Mechanism of Reservations

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.

Reservation is updated - Magento MSI - Salable Quantity Calculation and Mechanism of Reservations

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).

Shipping items - Magento MSI - Salable Quantity Calculation and Mechanism of Reservations

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.

Reservation cleaning - Magento MSI - Salable Quantity Calculation and Mechanism of Reservations

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.

Salable equal stock quantity - Magento MSI - Salable Quantity Calculation and Mechanism of Reservations

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

Top comments (0)