BuyNowButton
The BuyNowButton component renders a button that adds an item to the cart and redirects the customer to checkout.
Must be a child of a CartProvider component.
Anchor to propsProps
- Anchor to childrenchildrenchildrenReactNodeReactNoderequiredrequired
Any ReactNode elements.
- Anchor to variantIdvariantIdvariantIdstringstringrequiredrequired
The ID of the variant.
- Anchor to asasasAsTypeAsType
Provide a React element or component to render as the underlying button. Note: for accessibility compliance, almost always you should use a
buttonelement, or a component that renders an underlying button.- Anchor to attributesattributesattributes{ key: string; value: string; }[]{ key: string; value: string; }[]
An array of cart line attributes that belong to the item being added to the cart.
- Ref<HTMLButtonElement>Ref<HTMLButtonElement>
A
refto the underlying button- Anchor to defaultOnClickdefaultOnClickdefaultOnClick(event?: MouseEvent<HTMLButtonElement, MouseEvent>) => boolean | void(event?: MouseEvent<HTMLButtonElement, MouseEvent>) => boolean | void
A default
behavior- Anchor to onClickonClickonClick(event?: MouseEvent<HTMLButtonElement, MouseEvent>) => boolean | void(event?: MouseEvent<HTMLButtonElement, MouseEvent>) => boolean | void
Click event handler. Default behaviour triggers unless prevented
- Anchor to quantityquantityquantitynumbernumber
The item quantity. Defaults to 1.
- Anchor to sellingPlanIdsellingPlanIdsellingPlanIdstringstring
The selling plan ID of the subscription variant
Was this page helpful?