Fetch product stock across warehouses
Check real-time inventory for a product, broken down by warehouse location, including supplier stock and next delivery date.
Query
query GetProductStock($productId: Int!) {
product(productId: $productId) {
productId
inventory {
totalQuantity
localQuantity
supplierQuantity
nextDeliveryDate
balance {
quantity
warehouseId
}
}
}
}
Variables
{
"productId": 12345
}
Response
{
"data": {
"product": {
"productId": 12345,
"inventory": {
"totalQuantity": 340,
"localQuantity": 200,
"supplierQuantity": 140,
"nextDeliveryDate": "2026-03-01T00:00:00.000Z",
"balance": [
{ "quantity": 120, "warehouseId": 1 },
{ "quantity": 80, "warehouseId": 2 }
]
}
}
}
}
How it works
totalQuantity is the sum of localQuantity (your own warehouses) and supplierQuantity (external suppliers). The balance array breaks stock down per warehouse so you can show regional availability or route orders to the nearest fulfillment location.
If your ERP reports allocated stock, select totalFreeQuantity to show what you can still promise, because totalQuantity also counts units that are sold but not yet shipped. nextExpectedDeliveryDate gives the first delivery date of stock that is actually on its way, where nextDeliveryDate takes the earliest date on any record. Both are null when your ERP does not report these figures.