Skip to main content
Redirects the user to Shopify’s hosted checkout page.

Parameters

Returns

void
This method redirects the browser. Any code after checkout() will not execute.

Examples

Checkout button

Checkout with validation

Checkout with custom return URL

Checkout with dynamic return URL

Checkout with confirmation

Disable button if cart empty

Behavior

  1. Gets the checkout URL from the current cart
  2. Redirects the browser using window.location.href
  3. User completes checkout on Shopify’s hosted page
After checkout completion, Shopify will redirect the user based on your store’s settings (typically to an order confirmation page).