CartActions
Full action surface for a cart, assembled from and
capability-gated mixin types. Pass the same C as the kernel snapshot's
capabilities to receive a correctly narrowed object from .
Definition
type CartActions = BaseCartActions<TExt> & C['giftCards'] extends true ? GiftCardActions<TExt> : Record<never, never> & C['multipleDiscountCodes'] extends true ? DiscountActions<TExt> : Record<never, never> & C['notes'] extends true ? NoteActions<TExt> : Record<never, never> & C['cartAttributes'] extends true ? CartAttributeActions<TExt> : Record<never, never> & C['buyerIdentity'] extends true ? BuyerIdentityActions<TExt> : Record<never, never>;BaseCartActions<TExt> & C['giftCards'] extends true ? GiftCardActions<TExt> : Record<never, never> & C['multipleDiscountCodes'] extends true ? DiscountActions<TExt> : Record<never, never> & C['notes'] extends true ? NoteActions<TExt> : Record<never, never> & C['cartAttributes'] extends true ? CartAttributeActions<TExt> : Record<never, never> & C['buyerIdentity'] extends true ? BuyerIdentityActions<TExt> : Record<never, never>
Example
const actions = useCartActions<CartCapabilities>();
await actions.addLine({ variantId: 'gid://shopify/ProductVariant/123', quantity: 1 });Related
CartDevtools CartFormProps CartProviderProps AppCartConfig BaseCartActions BuyerIdentityActions CartAttributeActions CartPredictor
cachePredictor
Build a line predictor that looks merchandise up via a hostsupplied KV getter (e.g., a product cache keyed by variant id). The returned partial merchandise is m
CartAttributeActions
Cartattribute mutation method added to when CartCapabilities.cartAttributes is true. Replaces all cart attributes atomically with the supplied keyvalue pairs.