Cart

The Cart component is a slide-out drawer that manages items, quantities, promo codes, and checkout.

What you get

  • Drawer UI with item list and totals

  • Grouped items by retailer

  • Quantity updates and removals

  • Promo code support

  • Cart persistence across sessions and tabs

  • Checkout entry point

Show a cart button (CDN)

<script
  defer
  data-liquid-commerce-elements
  data-token="YOUR_API_KEY"
  data-env="production"
  data-cart-badge-button="header-cart"
  type="text/javascript"
  src="https://assets-elements.liquidcommerce.us/all/elements.js"
></script>

<div id="header-cart"></div>

Cart UI helpers (programmatic)

Cart actions

Address behavior

If no address is set, add-to-cart automatically opens the address prompt, then retries the add.

Cart events (examples)