seedInventory
Requires permission inventory:stock_level:create.
Creates a zero-quantity stock line for every active product variant that has none in a warehouse, so all products appear in stock levels. Without warehouseId it uses the default warehouse. Running it again skips lines that already exist. Needs the stock level 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:
- GraphQL
- cURL
mutation SeedInventory {
seedInventory {
warehouseName
created
skipped
total
warehouseId
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation SeedInventory {\n seedInventory {\n warehouseName\n created\n skipped\n total\n warehouseId\n }\n}"
}
EOF
Response:
{
"data": {
"seedInventory": {
"warehouseName": "string",
"created": 0,
"skipped": 0,
"total": 0,
"warehouseId": "string"
}
}
}
seedInventory(
warehouseId: ID
): SeedInventoryResponse!
Arguments
seedInventory.warehouseId ● ID scalar
Only this warehouse. Omit for all warehouses.
Type
SeedInventoryResponse object
The result of creating empty stock rows for a warehouse.