> ## Documentation Index
> Fetch the complete documentation index at: https://docs.smartwpplugins.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Where customers land

> Where a link sends the customer when it works, and when it's refused

Following a preset link always ends in a redirect. Where it goes depends on one thing: whether anything reached the cart.

If something did, the link worked, in whole or in part, and **Redirect after adding** decides. If nothing did, the link was refused, and **Unavailable links** decides. Both live under **Settings → Cart behaviour**, and a preset can answer either one for itself. Overriding **Unavailable links** on a preset needs Pro.

## Redirect after adding

Set this store-wide under **Settings → Cart behaviour → Redirect after adding**. A preset can override it.

| Choice | Where they go | Key |
| - | - | - |
| Cart | Your cart page, holding the preset | `cart` |
| Checkout | Straight to checkout | `checkout` |
| Stay on the page | Back where they came from | `stay` |
| Custom URL | An address you choose, in the **Custom URL** field below the choices | `custom` |

The same four choices, in the same words, appear store-wide and on a single preset.

**Cart** is the default and the safe choice: the customer sees what they got before they commit to it.

**Checkout** shortens the path for a campaign where the customer already knows the offer.

**Stay on the page** is for links embedded in your own content. A button inside a blog post can fill the cart and leave the reader exactly where they were reading.

🖼️

Screenshot pending

The "Redirect after adding" block with the four choices, Custom URL selected and an address entered

### How "stay" decides where that is

From the referring page, and only if it's one of yours.

A referer from another site is ignored, and the customer goes to your home page instead. Otherwise any site could embed your preset link and bounce your customers back to itself.

No referer at all also goes to your home page. That's a link pasted into the address bar, or a browser that sends none.

### Per-preset override

Each preset can choose its own destination in the editor's **Cart behaviour** card, under **Redirect after adding**. The block has two modes. On **Store default** it names the store's current choice, such as "Using the store default: **Cart**.", so you can see what the default means without leaving the page. Choose **Override** and the four choices appear, starting from the store's answer.

## Unavailable links

A link can be refused in ten ways, and one setting covers them all. Sold out, expired and not allowed all send the customer to the same place.

Set it store-wide under **Settings → Cart behaviour → Unavailable links**. It's editable on both versions.

| Setting | Choices | Key |
| - | - | - |
| Unavailable links | **Cart** · **Custom URL** | `refused_action` |
| Custom URL | The address, in a **Custom URL** field that appears when you choose **Custom URL**. Required then | `refused_url` |
| Show an error message | On by default | `refused_notice` |

Each reason keeps its own sentence, so "sold out" and "please sign in" read differently. What they share is where the customer goes, and whether they're told anything at all.

| Situation | Notice ID |
| - | - |
| The link matches no preset | `not_found` |
| Not started yetPro | `scheduled` |
| Ended, inactive, or sold out | `unavailable` |
| Not enough room left under the total capPro | `limit_total` |
| Per-customer cap reachedPro | `limit_customer` |
| The preset is for signed-in customers onlyPro | `not_signed_in` |
| The customer holds none of the roles the preset allowsPro | `role_not_allowed` |
| The preset has no items | `no_items` |
| An item cannot be bought, and your rule is "refuse the preset" | `item_blocked` |
| Every item failed at cart time | `nothing_added` |

You can rewrite all ten sentences. See [Cart notices and wording](https://docs.smartwpplugins.com/cartpresets/links/wording.md).

> [!NOTE]
>
> The only choices are the cart or a custom URL. There's no separate fallback link behind them. If you want refused customers on your shop page, paste the shop page in as the custom URL, and then you can see where they land.

### Telling them why

The reason is shown as a WooCommerce notice, and it's your theme that prints it, not this plugin.

The cart always prints them, and so do the Cart and Checkout blocks. A custom landing page often doesn't: a page template that never calls `woocommerce_output_all_notices` shows nothing, whatever the switch is set to. Test the page you chose before a campaign goes out.

### Overriding it on one preset

A preset carries the same three keys, and on a preset `refused_action` also accepts `global`, which follows the store. You set it in the editor's **Cart behaviour** card, under **Unavailable links**, by switching from **Store default** to **Override** and choosing **Cart** or **Custom URL**. On **Store default** the block names the store's answer, for example "Cart, with the reason shown".

The editor has no **Show an error message** switch of its own. A preset that overrides keeps its stored `refused_notice`, which is on unless an import or the REST API set it off. Its **Cart** choice says so: "With a notice saying why the link could not be used."

The override is ProPro. On the free version the block is locked with a **Pro** tag. A stored override is still honoured there, and the editor shows it as stored, so moving to the free version doesn't quietly send a customer somewhere you didn't choose.

A custom destination with no address falls back to the cart. Both screens refuse to save an empty one, so this only catches bad stored data. It isn't something you can set up.

## When part of a preset works

Sometimes most of a preset works. That counts as a success, so none of the refusal settings above apply. The customer keeps what could be added, **Redirect after adding** decides where they land, an automatic coupon still applies, and the caveat message explains what was skipped.

| Situation | Notice ID |
| - | - |
| They already hold this preset | `already_in_cart` |
| One item is out of stock | `item_out_of_stock` |
| One item is limited to one per order, so the quantity was trimmed | `item_qty_capped` |
| One item is unavailable for any other reason | `item_unavailable` |

The **Unavailable items** setting decides whether a failing item is skipped or refuses the whole preset. See [Items](https://docs.smartwpplugins.com/cartpresets/building/items.md). Choose "Refuse the preset" and that case becomes a refusal, `item_blocked`, with nothing reaching the cart.

## External addresses work

Custom destinations, per-preset custom URLs and refusal links can all point at another domain.

WordPress's own `wp_safe_redirect()` rewrites an outside host to wp-admin, which would send your customer to a dashboard login. CartPresets runs the destinations you configured through a helper that allow-lists that host, so the address you typed is the address they reach.

> [!NOTE]
>
> This applies only to addresses you configured in settings. A host arriving in a request is never trusted.

## Settings reference

| Setting | Level | Key | Default |
| - | - | - | - |
| Redirect after adding | Store | `post_add` | `cart` |
| Custom URL | Store | `post_add_url` | Empty |
| Redirect after adding | Preset | `redirect` | `global` (**Store default**) |
| Custom URL | Preset | `custom_url` | Empty |
| Unavailable links | Store | `refused_action` | `cart` |
| Custom URL | Store | `refused_url` | Empty |
| Show an error message | Store | `refused_notice` | On |
| Unavailable linksPro | Preset | `refused_action` | `global` (**Store default**) |
| Custom URL | Preset | `refused_url` | Empty |
| Show an error message (no editor control) | Preset | `refused_notice` | On |

## For developers

`cartpresets_post_add_url` filters the resolved destination and is safety-clamped. See the [hooks reference](https://docs.smartwpplugins.com/cartpresets/developers/hooks-reference.md#cart).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.