Skip to main content

applyStockCount

Requires permission inventory:stock_adjustment:create.

Applies a stock count for one warehouse, all or nothing. Every line whose counted quantity differs from expectedOnHand becomes one ADJUSTMENT movement. If any line's on-hand changed since it was counted, nothing is written and the count is refused. At most 500 lines; batch- or serial-tracked stock is counted in the console. Needs the stock adjustment create 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:

mutation ApplyStockCount($input: ApplyStockCountInput!) {
applyStockCount(input: $input) {
id
warehouseId
movements {
id
movementNumber
status
quantity
variantId
}
}
}

Variables:

{
"input": {
"lines": [
{
"countedQuantity": 0,
"expectedOnHand": 0,
"variantId": "id"
}
],
"reason": "string",
"warehouseId": "id"
}
}

Response:

{
"data": {
"applyStockCount": {
"id": "id",
"warehouseId": "id",
"movements": [
{
"id": "id",
"movementNumber": "string",
"status": "string",
"quantity": "string",
"variantId": "id"
}
]
}
}
}
applyStockCount(
input: ApplyStockCountInput!
): StockCount!

Arguments​

applyStockCount.input ● ApplyStockCountInput! non-null input​

The warehouse, the reason and the counted lines.

Type​

StockCount object​

An applied stock count. Lines that matched on-hand wrote nothing, so they have no movement.