Manage inventory with the Cart

Elevate, May 20-22-2025, Miami Beach, Florida

Learn about the relationship between a Cart and the Inventory entity.

  • After completing this page, you should be able to:

    • Understand different Cart inventory modes and how they impact the process of converting a Cart to an Order.
  • 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

    • None: adding items to the Cart and creating Orders do not impact inventory levels. This mode is suitable for scenarios where inventory management is handled entirely by an external system, such as an Inventory Management Service (IMS), or when you want to implement custom inventory logic within your application.
    • TrackOnly: this mode allows the addition of any quantity of items to a Cart, regardless of available stock. Inventory is only reduced (and can go negative) when an Order is placed. This mode is useful for allowing overselling scenarios, accepting backorders, or when you want to allow customers to order items even if they are temporarily out of stock.
    • ReserveOnOrder: similar to TrackOnly, this mode permits the addition of any quantity to the Cart. However, an Order can only be created if sufficient inventory exists at the time of order placement. Inventory is reduced upon successful order placement. This mode helps prevent overselling by reserving stock for orders.

    Important considerations

    • Client-side availability checks: it's crucial to understand that the inventory mode settings do not inherently prevent adding items to the Cart that have exceeded their available inventory. Your application is responsible for performing these checks beforehand, using either the ProductVariantAvailability object or the Inventory API endpoints, and providing appropriate feedback to the customer. This proactive approach ensures a smoother user experience during the checkout process by preventing order failures due to insufficient stock.
    • Line item InventoryMode and supplyChannel: while a default InventoryMode is set at the Cart level, you have the flexibility to override it for individual line items. Additionally, each line item can be associated with a specific supplyChannel to accurately reflect inventory availability within that channel. Omitting the supplyChannel will default to using the general inventory level. This is important because your application is responsible for deciding which InventoryEntry fulfills a given line item. This granularity is essential for effectively managing inventory across multiple sales channels.
    • Fulfilling from multiple inventory entries: if your fulfillment strategy involves fulfilling a single SKU from multiple inventory locations (for example: to optimize shipping times, costs, or this is a marketplace scenario), you can achieve this by creating multiple line items for the same SKU within the Cart. Each line item should be associated with the appropriate supplyChannel to mark stock against specific inventory entries. This approach allows for more efficient and accurate order fulfillment by managing inventory reservations at a granular level.

    By understanding and effectively utilizing the InventoryMode and supplyChannel settings, you can create a robust and flexible inventory management system within your Composable Commerce application, catering to various business requirements and complexities.