See Types for full interface definitions.
Features
- Session Persistence - Cart state persists across page reloads within the browser session
- Reactive Updates - Subscribe to cart changes for automatic UI updates
- Full CRUD - Add, update, remove, and clear cart items
- Shopify Checkout - Direct integration with Shopify’s hosted checkout
Methods
.init()
Initialize cart session
.add()
Add items to cart
.update()
Update item quantities
.remove()
Remove items from cart
.clear()
Remove all items
.get()
Get full cart state
.lines()
Get cart line items
.count()
Get total item count
.checkoutUrl()
Get checkout URL
.checkout()
Redirect to checkout
.subscribe()
Listen for cart changes