variantWarehouseStock
Requires at least one of the permissions inventory:stock_level:read, sales:quote:create, sales:sales_order:allocate or sales:sales_order:create.
For each variant given, returns the on-hand, reserved and available stock in each warehouse that holds it, including warehouses at zero. A variant with no stock record anywhere is untracked: it returns every active warehouse without quantities. Inactive and deleted warehouses are left out, and at most 200 variants are looked up. Needs the stock level read permission, or the quote create, sales order create or sales order allocate permission.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
query VariantWarehouseStock($variantIds: [ID!]!) {
variantWarehouseStock(variantIds: $variantIds) {
warehouseCode
warehouseName
availableQuantity
onHandQuantity
reservedQuantity
tracked
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query VariantWarehouseStock($variantIds: [ID!]!) {\n variantWarehouseStock(variantIds: $variantIds) {\n warehouseCode\n warehouseName\n availableQuantity\n onHandQuantity\n reservedQuantity\n tracked\n }\n}",
"variables": {
"variantIds": [
"id"
]
}
}
EOF
Variables:
{
"variantIds": [
"id"
]
}
Response:
{
"data": {
"variantWarehouseStock": [
{
"warehouseCode": "string",
"warehouseName": "string",
"availableQuantity": 0,
"onHandQuantity": 0,
"reservedQuantity": 0,
"tracked": true
}
]
}
}
variantWarehouseStock(
variantIds: [ID!]!
): [VariantWarehouseStock!]!
Arguments
variantWarehouseStock.variantIds ● [ID!]! non-null scalar
The IDs of the variants to look up. Only the first 200 are used.
Type
VariantWarehouseStock object
How much of a variant one warehouse holds and how much of it is free. Quantities are in the variant's base unit.