CartState

interface CartState { items: CartItem[]; totalQuantity: number; isEmpty: boolean; vouchers: string[]; swapInProgress?: boolean; currency?: string; offerDiscounts?: Discount[]; voucherDiscounts?: Discount[]; subtotal: Decimal; shippingMethod?: ShippingMethod; hasDiscounts: boolean; totalDiscount: Decimal; totalDiscountPercentage: Decimal; total: Decimal; summary?: CartSummary; isCalculating: boolean; }

Source: global.ts:1070

The full cart snapshot — items, totals, discounts, and shipping — as held in useCartStore and delivered with every cart:updated event. This is what you read to render prices, item counts, and totals.


Properties

items: CartItem[]

All items currently in the cart.

totalQuantity: number

Total unit count across all items (sum of each item's quantity × qty).

isEmpty: boolean

true when the cart has no items.

vouchers: string[]

List of applied coupon codes.

swapInProgress: boolean

true while a package swap animation is in progress. Use to prevent double-clicks.

currency: string

ISO currency code of cart data.

offerDiscounts: Discount[]

Detailed offer information for offers applied to the cart.

voucherDiscounts: Discount[]

Detailed voucher information for vouchers applied to the cart.

subtotal: Decimal

Cart subtotal before shipping and discounts.

shippingMethod: ShippingMethod

The currently selected shipping method and its pricing details.

hasDiscounts: boolean

true when any discount (coupon or offer) is applied.

totalDiscount: Decimal

Total discount amount from coupons and offers.

totalDiscountPercentage: Decimal

Total discount as a percentage of the subtotal.

total: Decimal

Cart grand total (subtotal + shipping − discounts).

summary: CartSummary

Raw CartSummary response from the API calculate endpoint.

isCalculating: boolean

true while the calculate API is in flight. Use to show loading state on price/total fields.