Allocation and inventory lifecycle
An inventory entry records total quantity and quantityAllocated. Its allocation strategy decides whether those values constrain purchasing and whether placed orders reserve units.
| Strategy | Availability | At order placement | At fulfillment |
|---|---|---|---|
NONE | Stock is not tracked for purchase limits | Reservation is skipped | Inventory fulfillment is skipped |
TRACK | Recorded stock contributes to tracked availability | Reservation is skipped | Allocation consumption is skipped |
TRACK_AND_ALLOCATE | Available quantity is total minus allocated units | Managed order lines request allocation | Fulfilled managed lines consume allocated and total quantity |
Reservation starts after placement
Adding a line to a cart does not reserve its stock. When cart completion or draft-order placement creates an order, Thor requests inventory reservation for managed lines after the order transaction commits. Eligible entries are restricted to the store’s supply channels; an unscoped entry can also participate. When several eligible entries exist for a SKU, the current implementation selects the entry with the most available stock.
Because reservation follows order creation, a reservation integration failure is logged rather than rolling the order back. Operational systems must monitor and reconcile orders whose stock could not be reserved.
Fulfillment consumes allocation
Creating an order fulfillment requests inventory fulfillment for managed catalog lines. TRACK_AND_ALLOCATE entries release the fulfilled quantity from quantityAllocated and reduce total quantity. Custom line items do not affect catalog inventory. Inventory integration failure is logged without rejecting the fulfillment record, so reconciliation remains important.
The reviewed public flow does not establish a general automatic release contract for order cancellation. Do not promise stock release in a client workflow unless that operation is verified for the deployed API; reconcile cancelled orders operationally.
Invariants
Allocated quantity cannot exceed total quantity. An allocated entry cannot be changed to NONE or deleted until its allocation is resolved. A checkout can fail availability checks when requested quantity exceeds current availability.