CartFormProps
●cart · /react·interface
Props for . Each field maps to a hidden <input> the cart
server action reads from FormData; only action, formAction, and
children are required for every mutation kind.
Properties
PROPTYPEDESCRIPTION
action
'add-line' | 'update-line' | 'remove-line' | 'clear' | 'apply-discount' | 'remove-discount' | 'apply-gift-card' | 'remove-gift-card' | 'update-note' | 'update-attributes' | 'update-buyer-identity' | 'custom'children
ReactNode
formAction
(formData: FormData) => unknown
code?
string
lineId?
string
Example
const props: CartFormProps = {
action: 'add-line',
variantId: 'gid://shopify/ProductVariant/123',
quantity: 1,
formAction: addToCartAction,
children: <button type="submit">Add to cart</button>,
};Related
CartDevtools CartProviderProps AppCartConfig BaseCartActions BuyerIdentityActions CartActions CartAttributeActions CartPredictor
CartDevtools
Developmentonly overlay that renders a toggleable JSON dump of cart provider state. Returns null in production builds so bundlers can treeshake the panel comple
CartForm
Renders a <form that encodes a cart mutation as hidden inputs consumed by a cart server action. Pass action to identify the mutation kind and supply the relevan