CartActions

cart · /react·type

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

@nordcom/commerce-cart
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 });

CartDevtools CartFormProps CartProviderProps AppCartConfig BaseCartActions BuyerIdentityActions CartAttributeActions CartPredictor

Metadata@nordcom/commerce-cart@0.2.2Open in GitHub ↗

On this page