Magento 2 troubleshooting › Stock and inventory
Why is salable quantity 0 when the product has stock?
Short answer: Salable quantity is the stock in the sources linked to the website's stock, minus open reservations, minus the out-of-stock threshold. When it's 0 while Quantity isn't, one of those three is the reason. Most often it's leftover reservations.
Since Magento 2.3, every placed order creates a reservation, a negative row in inventory_reservation. When the order ships or is canceled, a matching positive row cancels it out. If an order is deleted, edited by an import, or a process crashes halfway, the positive row never comes, and the stock stays “reserved” forever.
Check it step by step
These queries only read data. Run them on a copy of your database if you can, or ask your developer to. If your tables have a prefix (set in app/etc/env.php), add it to each table name.
1. Is the stock in a source that belongs to the website's stock?
Physical quantity only counts if its source is linked to the stock that sells on that website.
Works on Magento Open Source and Adobe Commerce:
SET @sku = 'ABC-123'; -- your SKU
SELECT isi.source_code, isi.quantity, isi.status,
l.stock_id, sc.code AS website_code
FROM inventory_source_item isi
LEFT JOIN inventory_source_stock_link l ON l.source_code = isi.source_code
LEFT JOIN inventory_stock_sales_channel sc ON sc.stock_id = l.stock_id AND sc.type = 'website'
WHERE isi.sku = @sku;
If stock_id is empty, the source isn't linked to any stock (Stores › Inventory › Stocks). If status is 0, the source item is set to Out of Stock.
2. How much is reserved?
Reservations add up per SKU and stock. Open orders explain some; the rest are leftovers.
Works on Magento Open Source and Adobe Commerce:
SET @sku = 'ABC-123'; -- your SKU
SELECT r.stock_id, SUM(r.quantity) AS reserved, COUNT(*) AS rows_count
FROM inventory_reservation r
WHERE r.sku = @sku
GROUP BY r.stock_id;
A total of -40 means 40 units are held. Compare it with the quantity on orders that aren't shipped, canceled or closed yet.
3. Find every SKU with leftover reservations
Large negative totals on products with no open orders are almost always stuck reservations.
Works on Magento Open Source and Adobe Commerce:
SELECT r.sku, r.stock_id, SUM(r.quantity) AS reserved
FROM inventory_reservation r
GROUP BY r.sku, r.stock_id
HAVING reserved < 0
ORDER BY reserved
LIMIT 50;
4. What does the stock index say?
The storefront reads the stock index, not the source items. Stock 1 (Default Stock) is a view; other stocks are tables named inventory_stock_<id>.
Works on Magento Open Source and Adobe Commerce:
SET @sku = 'ABC-123'; -- your SKU
SELECT sku, quantity, is_salable
FROM inventory_stock_1
WHERE sku = @sku;
How to fix it
- Let Magento compare reservations with open orders and add the missing compensations:
bin/magento inventory:reservation:list-inconsistencies -r | bin/magento inventory:reservation:create-compensations - Run
bin/magento inventory:reservation:list-inconsistencieson its own first to see what it will fix. - If a source isn't linked, add it to the stock in Stores › Inventory › Stocks, then reindex:
bin/magento indexer:reindex inventory. - Check Stores › Configuration › Catalog › Inventory › Product Stock Options › Out-of-Stock Threshold; a threshold of 5 makes 5 units unsellable.
Good to know
- Never delete rows from
inventory_reservationby hand on a live store: open orders need them, and you'll oversell.