Overview of the concepts related to inventory management.
Inventory tracks sellable stock per SKU across supply locations. It enables you to manage stock levels, enforce purchase limits, and reserve stock to ensure availability during the checkout process.
General concepts
Inventory modes
| Inventory Mode | Description | Use Cases |
|---|---|---|
None | The default inventory mode. Stock levels are not checked or updated when Line Items are added to the Cart. | - Products that are always in stock (for example: digital goods). - Businesses that do not require inventory management. - Businesses that manage their inventory externally. |
TrackOnly | Stock levels are checked when Line Items are added to the Cart, but stock is only updated when the Order is created. Allows Orders to be placed even if the required stock is not available at that moment. | - Products with high stock levels where reservations are unnecessary. - Businesses that want to monitor stock without reserving it. - Allows for overselling scenarios and accepting backorders. |
ReserveOnOrder | Stock levels are checked when Line Items are added to the Cart, but stock is only reserved and updated when the Order is created. Prevents Orders from being placed if the required stock is not available at that moment. | - Standard inventory management where stock is only deducted upon Order creation. - Businesses that want to avoid holding stock before the order is finalized. |
ReserveOnCart BETA | Stock levels are checked and reserved when Line Items are added to the Cart. Reservations expire after a set time. | - High-demand products where stock needs to be secured during checkout. - Businesses that want to minimize the risk of stockouts during checkout. |
Inventory modes can be set at the Cart level and/or individually for each Line Item. The Line Item's inventory mode takes precedence over the Cart's mode.
Manage inventory with InventoryEntry
Quantity limits
minCartQuantity: the minimum allowed quantity for a Line Item in the Cart. This prevents customers from adding quantities below the specified threshold.maxCartQuantity: the maximum allowed quantity for a Line Item in the Cart. This caps the quantity a customer can purchase at once.
The following applies:
-
Quantity limits are independent of InventoryMode: the
minCartQuantityandmaxCartQuantitylimits are enforced regardless of which InventoryMode is used (None, TrackOnly, ReserveOnOrder, or ReserveOnCart). The inventory mode controls when and how stock is reserved or updated, but does not affect quantity limit enforcement. -
Each Line Item is evaluated independently: each Line Item that matches an InventoryEntry record is evaluated independently against that InventoryEntry's defined quantity limits, regardless of whether other Line Items in the Cart use the same SKU, Product Variant, or supply Channel. This applies both when you have multiple Line Items for the same SKU and supply Channel (for example, distinguished by Custom Fields) and when you have Line Items for the same SKU across different supply Channels, allowing you to enforce distinct quantity constraints per Line Item context.
Enforcement scenarios
The following table details when quantity limits are enforced:
| Scenario | Enforcement | Notes |
|---|---|---|
| Cart creation | Yes | If any Line Item exceeds its quantity limits, the Cart creation fails. |
| Cart update | Yes | If any Cart update action results in a Line Item violating quantity limits, the entire request fails. |
| Order creation from Cart | Yes | Quantity limits are enforced when creating an Order from a Cart. If any Line Item in the Cart violates the current limits (for example, after limits change or for Frozen Carts), the order creation fails. |
| Order Edits | No | Quantity limits are not enforced during order edits. |
| Order Imports | No | Quantity limits are not enforced during order imports. |
Workarounds
maxCartQuantity for a single Product Variant, consider the following options:- Custom field workaround: add custom fields with different values to Line Items. This allows creating multiple Line Items for the same Product Variant, each subject to the quantity limits individually. The total quantity across all Line Items can exceed the limit of a single Line Item.
- Adjust or remove quantity limits: modify the
minCartQuantityormaxCartQuantityvalues on the InventoryEntry, or remove the limits entirely. - Use another InventoryEntry: create or use a different InventoryEntry for the same SKU without quantity limits, potentially with a different supply channel.
Stock level notifications BETA
quantityOnStock amount of an InventoryEntry falls below or rises above certain thresholds.stockLevels field of each InventoryEntry.| Field | Purpose | Typical use cases | Message sent |
|---|---|---|---|
reorderPoint | Early-warning threshold indicating stock is low and should be replenished before running out during lead time. | - Trigger notifications or automations (ERP/OMS) to create purchase orders. - Show "low stock" messaging on the storefront. - Highlight low stock levels in internal dashboards. | InventoryEntryReorderPoint |
safetyStock | Critical minimum threshold showing that inventory has reached an urgent, buffer-level quantity. | - Signal a critical low-stock situation. - Allow OMS/ERP to limit or stop selling. - Display "very low stock" or hide items on certain sales channels. | InventoryEntrySafetyStock |
Inventory checks and consistency
- Direct updates to InventoryEntry using the Inventory API are strongly consistent and immediately visible.
- Order operations using the
ReserveOnOrderorTrackOnlyinventory modes are eventually consistent. This means that changes to theavailableQuantityandquantityOnStockfields of the corresponding InventoryEntry may take up to 10 seconds to appear. - Reservation-based updates to resources using the
ReserveOnCartinventory mode are eventually consistent. This means that changes to theavailableQuantityandquantityOnStockfields of the corresponding InventoryEntry may take up to 10 seconds to appear. The following endpoint and update actions are affected if the Cart or Line Items use theReserveOnCartinventory mode:- Create Order from Cart
- Cart update actions
changeLineItemQuantity,addLineItem,removeLineItem, andsetLineItemInventoryMode.
To obtain the most accurate stock data (for example, when adding items to a cart, performing fulfillment checks, etc.), query the corresponding InventoryEntry. We recommend that you only fetch the data that you need. For example, avoid loading all InventoryEntries for a SKU when you only need supply channel availability or specific stock details.
availability field in ProductVariant. This provides an overview of stock levels which may lag behind real-time stock levels by a few seconds. However, checking inventory in this manner reduces the need to query the Inventory API directly.Supply channels versus distribution channels
supplyChannel field. A Cart bound to a Store filters available stock and prices using the Store's configured channels.To fulfill a single SKU from multiple inventory locations, you can add multiple Line Items to the Cart, each specifying a different supply channel.
Reservations BETA
- The Cart's inventory mode is
ReserveOnCart. - One or more Line Item's inventory mode is set to
ReserveOnCartbut the Cart has a different inventory mode.
availableQuantity of the corresponding InventoryEntry is decreased by the reserved amount. When a reservation expires, or is released, the availableQuantity is increased accordingly.Set the default expiration
ReserveOnCart InventoryMode on Carts or individual Line Items. This step ensures that stock is not held indefinitely. You only have to set this once per Project.Reserve items
reservationExpirationInMinutes value set in the corresponding InventoryEntry, or if absent, the Project-level reservation expiration time. Reserved Line Items include a reservation field containing the reservation reference, which you can then expand to view additional details.Reserve all items in a Cart
ReserveOnCart during Cart creation.The following applies:
- If all items could be reserved, the Cart creation succeeds, and no warnings are present in the response.
- If some items could not be reserved, the Cart creation succeeds, however, those items are not added to the Cart. The response will contain a CannotCreateReservation warning for each Line Item that could not be reserved/added.
- If no Line Items could be reserved, the Cart creation fails.
Reserve individual Line Items
ReserveOnCart. You can do this when adding items to a Cart, or for existing items, using the Set LineItem InventoryMode update action.The following applies:
- When changing an existing Line Item's inventory mode to
ReserveOnCartand there is insufficient stock available, the response contains a CannotCreateReservation warning. The Line Item remains in the Cart and the inventory mode remains unchanged. - When adding a new Line Item with the inventory mode set to
ReserveOnCart, and there is insufficient stock available, the response contains a CannotCreateReservation warning, and the Line Item is not added to the Cart.
Update a reservation
The following scenarios illustrate how to update an existing reservation:
Change the reserved quantity
availableQuantity of the associated InventoryEntry and extends the reservation expiration time.Extend the reservation expiration
To prevent Order creation failures due to a last-second expiration, the platform automatically attempts to renew expired Cart reservations during the Order creation process.
Release a reservation
ReserveOnCart to another inventory mode using the Set LineItem InventoryMode update action. This action increases the availableQuantity of the associated InventoryEntries accordingly.Handle reservation warnings
The following warnings may appear in Cart responses when working with reservations:
| Warning | Appearance |
|---|---|
| CannotCreateReservationWarning | Appears when creating a Cart with ReserveOnCart but one or more Line Items lack sufficient stock. No reservation is created. See Reserve items. |
| CannotUpdateReservationWarning | Appears when updating a Line Item's quantity but the reservation cannot be updated (usually due to insufficient stock). The Line Item quantity remains unchanged. |
| CannotChangeReservationExpiryWarning | Appears when trying to extend an expired reservation but insufficient stock prevents reacquiring it. The action succeeds, but the reservation expiry cannot be extended. |
Further reading
To learn more about implementing reservations, see the following tutorials:
- Reserve stock on Cart: learn how to automatically reserve items in a Cart.
- Reserve stock on demand and freeze prices: learn how to reserve items on demand while freezing all prices.