Skip to main content
Experimental. This Module has no test or production evidence recorded yet. Read it, run it locally, and hold off on real Orders. See maturity levels.
The Cart Module stores what a Guest or Customer intends to buy. It keeps each selection as a line item with a price snapshot, serves the endpoints below, and includes a Storefront cart drawer. Source: modules/cart · npm: @86d-store/cart
A Cart price is a snapshot, not an accepted offer. Checkout must recalculate Product identity, price, discounts, Inventory, Shipping, tax, and Payment on the server.

Installation

Configuration

Initialize the Module by passing it to your module client. Both options have defaults, so you can omit them.
number
default:"604800000"
Guest cart time-to-live in milliseconds. After this window elapses, the cart counts as expired. Defaults to 7 days (604,800,000 ms).
number
default:"100"
Maximum number of distinct line items a single cart may hold. Adding a new product beyond this limit returns an error. Updating the quantity of an existing item is not affected.

Store endpoints

All store endpoints return a consistent response shape:
POST /cart/clear removes all items but preserves the cart entity itself. The cart ID and its Customer or Guest association remain intact.

Admin endpoints

Components

Cart

The Cart component renders a slide-in drawer from the right side of the screen. It displays the current cart items, the subtotal, and a link to proceed to Checkout. The component fetches its own data and takes no props.
Place Cart in your main layout so it is available on every page:

CartButton

CartButton opens the cart drawer when clicked and shows a badge with the current item count when the cart has items.
Add it to the navbar actions slot:

CartDrawerInner

The inner content area of the cart drawer. Use this when you want to embed the cart contents directly on a page rather than inside a slide-out panel.

CartFloatingPill

A compact floating pill at the bottom of the viewport. It shows the item count and opens the cart drawer on click, which makes it a good fit for mobile-first layouts in place of CartButton.

Types

Current behavior and limits

Guest vs. authenticated carts. Guest carts are identified by a guestId UUID. When a Customer signs in, their guest cart can coexist alongside their authenticated cart; both carts reference different IDs. If you want them merged, your Checkout flow has to do it. Deterministic item IDs. Cart item IDs follow the pattern ${cartId}_${productId}[_${variantId}]. This means adding the same product (or product plus variant) twice merges the quantity into the existing line item rather than creating a duplicate. Different variants of the same product are always treated as separate line items. Swappable storage. The Module ships with an in-memory adapter by default. To use a different persistence layer, replace the adapter in your module configuration.