Inventory

An inventory entry connects a variant SKU to an optional supply channel and records quantity, quantityAllocated, and an allocation strategy. This keeps catalog identity separate from stock held at a fulfillment source.

Allocation strategies

StrategyBehavior
NONEDoes not track or reserve inventory for purchase limits
TRACKTracks inventory without reserving units during checkout
TRACK_AND_ALLOCATETracks inventory and reserves units for active purchasing flows

Choose the strategy based on the operational guarantee you can maintain. Use TRACK_AND_ALLOCATE when Thor must prevent active purchasing flows from consuming the same available units. Use TRACK when counts are informative but reservation is handled elsewhere.

Supply channels and stores

Supply channels represent inventory sources such as warehouses. A store selects the supply channels available to it. Stock in a channel outside the selected store does not contribute to that store’s availability.

Use one entry per SKU and supply context that you synchronize independently. Preserve warehouse or ERP identifiers in metadata when they are needed for reconciliation.

Storefront availability

Storefront variants expose an availability object with:

  • stockPolicy, which states whether inventory is tracked.
  • availableQuantity, the quantity available in the current context.
  • purchaseEnabled, whether purchasing is enabled for the current store’s distribution channels before status, publication, and stock are considered.
  • availableForPurchase, the final buyer-facing availability result.

Do not infer purchasability from quantity alone. Publication, product and variant status, store configuration, price context, and inventory policy all contribute. See Catalog visibility.

Worked availability cases

Suppose a SKU has 10 units in warehouse A and 4 are allocated. Its available quantity is 6. A store that includes warehouse A as a supply channel can use those units; a store connected only to warehouse B cannot.

With TRACK_AND_ALLOCATE, order placement reserves managed line items after the order transaction commits. Thor chooses the eligible store supply entry with the most available stock. A reservation failure is logged for operations to reconcile; it does not roll back an order that was already committed. Fulfillment later deallocates the reserved quantity and decreases physical stock. Custom line items do not participate in inventory allocation.

Synchronization guidance

  • Update inventory by stable SKU and supply-channel mapping.
  • Avoid lowering quantity below already allocated stock.
  • Use bulk operations in bounded batches. Inventory bulk creation accepts at most 100 entries and is transactional, so correct the failing batch before retrying it.
  • Reconcile periodically even when webhooks or upstream events drive near-real-time updates.

API reference