Create inventory
Add a stock record for a product in a warehouse or at a supplier.
Mutation
mutation CreateInventory($input: CreateInventoryInput!) {
inventoryCreate(input: $input) {
id
productId
quantity
warehouseId
location
supplier
costPrice
nextDeliveryDate
notes
total
warehouse {
id: warehouseId
name
}
}
}
Variables
{
"input": {
"type": "local",
"productId": 26,
"quantity": 500,
"warehouseId": 1,
"location": "AISLE-4-SHELF-B",
"notes": "Initial stock import from ERP",
"costPrice": 12.50,
"nextDeliveryDate": "2026-04-01T00:00:00.000Z"
}
}
Response
{
"data": {
"inventoryCreate": {
"id": "98422",
"productId": 26,
"quantity": 500,
"warehouseId": 1,
"location": "AISLE-4-SHELF-B",
"supplier": "INTERN",
"costPrice": 12.50,
"nextDeliveryDate": "2026-04-01T00:00:00.000Z",
"notes": "Initial stock import from ERP",
"total": 500,
"warehouse": {
"id": 1,
"name": "Main Warehouse"
}
}
}
}
Supplier inventory
Use type: "supplier" to record stock held by a supplier rather than in a warehouse. The supplier field defaults to the product's supplier if not provided.
{
"input": {
"type": "supplier",
"productId": 26,
"quantity": 2000,
"supplier": "Ingram Micro",
"nextDeliveryDate": "2026-03-15T00:00:00.000Z",
"notes": "Supplier confirmed availability"
}
}
Inventory types
| Type | Behavior |
|---|---|
local | Stock in a warehouse. Defaults supplier to INTERN. |
supplier | Stock held by an external supplier. Defaults supplier to the product's supplier field. |
How it works
Each inventory record represents a stock quantity for one product in one warehouse (or at one supplier). A product can have multiple inventory records across different warehouses. The total field in the response sums up all inventory for that product. Use location to specify a bin or shelf position within a warehouse. The nextDeliveryDate field is informational and shown to buyers when a product is out of stock.
See also
- Delete inventory — remove an inventory record
- Fetch product stock across warehouses — query inventory from the storefront