SelectedVariantAddToCartButton

The SelectedVariantAddToCartButton component renders a AddToCartButton for the product's selected variant. Clicking this button automatically adds the selected variant to the cart. It must be a descendent of a ProductProvider and CartProvider component.

Example code

Alias

The SelectedVariantAddToCartButton component is aliased by the Product.SelectedVariant.AddToCartButton component. You can use whichever component you prefer.

Component type

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