thegeneralyst/AnopaDocs
Product

Buy Now Button

Creates a one-click purchase flow by creating a new Shopify cart with the selected variant and immediately redirecting to checkout, without touching the persistent cart.

Buy Now

AP_BuyNowButton creates a one-click purchase flow by creating a new Shopify cart containing only the selected variant and quantity, then immediately redirecting to checkout — without touching the persistent cart. It mirrors the four-state slot pattern of AP_AddToCartButton: Available, Loading, Out of Stock, and Select Variant, with Auto state derived from the selected variant’s availability. If no variant is selected and Open Drawer on Prompt is on, clicking opens the cart drawer instead of attempting checkout. Checkout can open in a new tab or the same tab.

Property Controls

ControlTypeDefaultDescription

Product ID

String

The Shopify product ID for this product. Required for the buy-now cart to reference the correct product.

Preview State

Enum

auto

Overrides the automatic state. Options: Auto, Available, Loading, Out of Stock, Select Variant. Use Auto in production.

Open Drawer on Prompt

Boolean

true

When on, opens the cart drawer if no variant is selected or if the buy-now redirect fails.

Open in New Tab

Boolean

true

When on, the Shopify checkout URL opens in a new browser tab.

Available

ComponentInstance

Slot shown when the selected variant is in stock and the button is ready to trigger checkout.

Loading

ComponentInstance

Slot shown while the buy-now checkout is being created.

Out of Stock

ComponentInstance

Slot shown when the selected variant has no available stock.

Select Variant

ComponentInstance

Slot shown when no valid variant has been selected yet.