# checkout_url

> Where the visitor goes to check out: the checkout url (or the invoice of a draft order), from the cart's checkout button, a buy now or `Smootify.checkout()`. Answer another url (parameters added, another checkout) or `false` to keep the visitor here (terms not accepted, a minimum order); the message of an error a filter throws shows in the cart. `smootify:initiate_checkout` goes out only when the visitor leaves.

Status: Ready (Smootify 2.0)  
URL: https://www.smootify.io/docs/reference/api/filters/checkout-url  
Updated: 2026-10-13

Where the visitor goes to check out: the checkout url (or the invoice of a draft order), from the cart’s checkout button, a buy now or `Smootify.checkout()`. Answer another url (parameters added, another checkout) or `false` to keep the visitor here (terms not accepted, a minimum order); the message of an error a filter throws shows in the cart. `smootify:initiate_checkout` goes out only when the visitor leaves.

Add it with `Smootify.addFilter`: answer the value changed, nothing to keep it, or `false` to stop.

```ts
checkout_url: ( url: string, context: CheckoutContext, ) => FilterAnswer<string> | Promise<FilterAnswer<string>>
```

## Types

### CheckoutContext

```ts
/**
 * What checks out. `cart`: the cart, or null for a buy now with a custom price, which skips the cart; `draftOrder`: the
 * url is the invoice of a draft order, whose data (after `draft_order_data`) is `draftOrderData`.
 */
export interface CheckoutContext {
  cart: Cart | null;
  draftOrder: boolean;
  draftOrderData?: DraftOrderData | undefined;
}
```

### FilterAnswer

```ts
/** What a filter answers: the value changed, nothing (`undefined`) to keep it, `false` to stop. */
export type FilterAnswer<T> = T | false | undefined;
```
