The SelectedVariantBuyNowButton component renders a BuyNowButton for the product's selected variant. Clicking this button automatically adds the selected variant to the cart and redirect the customer to checkout. It must be a descendent of a ProductProvider component.

Example code


Name Required Description
attributes No An array of cart line attributes that belong to the item being added to the cart.
quantity No The item quantity. Defaults to 1.
children Yes Any ReactNode elements.


The SelectedVariantBuyNowButton component is aliased by the Product.SelectedVariant.BuyNowButton component. You can use whichever component you prefer.

Component type

The SelectedVariantBuyNowButton component is a client component, which means that it renders on the client. For more information about component types, refer to React Server Components.