Carts provide flexibility in managing inventory through its Cart-level and Line-item-level
InventoryMode settings. This granular control dictates how inventory is tracked and decremented throughout the shopping journey.InventoryMode options
Choose the mode that matches when you want stock checks or reservations to happen, then apply a line item override only when a specific item needs different behavior from the rest of the Cart.
| InventoryMode | Use it when |
|---|---|
None | Your application or an external system owns inventory validation and reservation logic. |
TrackOnly | You want to accept demand first and reduce inventory only when the Order is created, even if stock can go negative. |
ReserveOnOrder | You want to defer the stock check until order creation, but still block Orders that exceed available inventory. |
ReserveOnCart BETA | You need to reserve (scarce) stock as soon as a Line Item enters the Cart. |
Important considerations
- Client-side availability checks: only
ReserveOnCartprevents customers from adding more items to a Cart than the available inventory supports. If you use another inventory mode, your application must perform that check before the item is added. You can use either theProductVariantAvailabilityobject or the Inventory API endpoints and then show appropriate feedback in the storefront. - Inventory consistency: when you create an Order from a Cart that uses
ReserveOnOrderorTrackOnly, or when you useReserveOnCart, changes to theavailableQuantityandquantityOnStockfields of the relatedInventoryEntryare eventually consistent and can take up to 10 seconds to appear. Direct API updates to inventory resources remain strongly consistent. - Line Item
InventoryModeandsupplyChannel: the Cart-levelInventoryModeacts as the default, but you can override it for individual Line Items. You can also assign asupplyChannelto each Line Item to reflect inventory availability in a specific channel. If you omit thesupplyChannel, commercetools uses the general inventory level. This matters because your application decides whichInventoryEntryfulfills a given Line Item. - Changing inventory mode on existing Line Items: you can change the
InventoryModeof an existing Line Item with the Set LineItem InventoryMode update action. When you change a Line Item toReserveOnCart, the platform creates a reservation if enough stock is available. When you change it fromReserveOnCartto another mode, the reservation is released. - Fulfilling from multiple inventory entries: if your fulfillment strategy uses multiple inventory locations for the same SKU, create multiple Line Items for that SKU in the Cart. Assign the appropriate
supplyChannelto each Line Item so stock is marked against the correct inventory entries. This approach supports more granular fulfillment decisions, such as marketplace scenarios or split fulfillment for shipping optimization.
By understanding and using
InventoryMode and supplyChannel effectively, you can build an inventory management approach that matches your business requirements. For more detail on the inventory modes and reservation behavior, see the Inventory overview and the reservations section.