Magento 2 SQL queries › Stock
What's the total stock quantity in each source?
Short answer: With Magento's multi-source inventory, each warehouse is a source and quantities live in inventory_source_item.
In the Magento admin
- Go to Stores › Inventory › Sources to see the sources, then filter the product grid by Quantity per Source.
With one query
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.
Works on Magento Open Source and Adobe Commerce:
SELECT isi.source_code,
COUNT(*) AS skus,
SUM(isi.status = 1) AS skus_in_stock,
SUM(isi.quantity) AS total_qty
FROM inventory_source_item isi
GROUP BY isi.source_code
ORDER BY total_qty DESC;
Good to know
- This is physical quantity. What customers can buy also depends on reservations (orders not yet shipped), so the salable quantity is lower; see why salable quantity is 0.