CommerceCart

Shopping cart layout: a list of line items on the left and a sticky order summary on the right (stacked on mobile). Presentational and theme-driven — pass quantity steppers / remove buttons as per-item controls and the totals as summary.

  • Canvas tote bag, natural

    Canvas Tote

    $48.00

    Natural · Medium

    Qty 1
  • Wool beanie, charcoal

    Wool Beanie

    $56.00

    Charcoal

    Qty 2
  • Leather cardholder, saddle

    Leather Cardholder

    $64.00

    Saddle

    Qty 1
Subtotal$168.00
Shipping$8.00
Tax$13.44
Total$189.44

Installation

pnpm
pnpm dlx @hex-core/cli add commerce-cart

API Reference

PropTypeDefaultDescription
itemsrequired
objectReadonlyArray<{ name; price; quantity; image?; meta?; controls? }>. Cart line items. quantity renders as text; pass an editable stepper + remove button via per-item controls.
summary
ReactNodeOrder summary rows (subtotal, shipping, total) — pass your own markup.
actions
ReactNodePrimary action(s) (proceed to checkout) — pass a <Button>.
className
stringAdditional classes applied to the root <section>.

AI Guidance

When to use

Use for the shopping cart page. Pass per-item quantity steppers and remove buttons via controls, and the totals via summary. Wire the checkout Button in actions.

When not to use

Don't use for a mini-cart popover (use a popover/sheet with a compact list) or for checkout itself (use commerce-checkout). Don't embed totals logic in the block — pass computed values.

Common mistakes

  • Rendering quantity as a static number with no way to edit — pass a stepper via controls for an editable cart.
  • Putting the order total in items instead of summary, so it scrolls away with the list.
  • Missing alt text on item thumbnails.

Accessibility

Each line item name renders as an <h3>. The summary card is sticky on desktop so totals stay visible. Per-item controls you pass must carry accessible names (e.g. 'Remove Canvas Tote').

Token budget: 700