Tutorial Magento 2 MSI - Multi-Source Inventory
Tags: magento, store, management
Published: 2020-06-30 16:02:05

---
title: Tutorial Magento 2 MSI - Multi-Source Inventory
published: true
description: 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.
tags: magento, store, management
cover_image: https://i.imgur.com/O9tqlYh.png
canonical_url: https://www.linkedin.com/pulse/how-does-magento-salable-quantity-calculation-work-corr%C3%AAa-gomes
---

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](https://dev-to-uploads.s3.amazonaws.com/i/yf9h6ge3iwseyrzph2gd.png)

## First Order
Our client bought 5 items of the same product.

![First Order - Magento MSI - Salable Quantity Calculation and Mechanism of Reservations](https://dev-to-uploads.s3.amazonaws.com/i/k6gca1gtz6x4mkheizg4.png)

## 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](https://dev-to-uploads.s3.amazonaws.com/i/k694o2v47nodjyj95eal.png)

## Items returned
Before invoicing the order there was the return of 3 items.

![Items returned - Magento MSI - Salable Quantity Calculation and Mechanism of Reservations](https://dev-to-uploads.s3.amazonaws.com/i/pgp62eeynvk24uaj37lv.png)

## 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](https://dev-to-uploads.s3.amazonaws.com/i/iomvp29upfk6mdk8x20y.png)

## 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](https://dev-to-uploads.s3.amazonaws.com/i/t1uhzjz2l84fpmoz23ki.png)

## 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](https://dev-to-uploads.s3.amazonaws.com/i/uyvo3jokwwzoicci8owt.png)

## 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](https://dev-to-uploads.s3.amazonaws.com/i/nlthqpvm6qx6n54ie8vr.png)

## 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](https://github.com/magento/inventory/wiki/Salable-Quantity-Calculation-and-Mechanism-of-Reservations)