> For the complete documentation index, see [llms.txt](https://native-app-co.gitbook.io/stork-credit/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://native-app-co.gitbook.io/stork-credit/automations/threshold-automations.md).

# Threshold automations

Reward loyalty as it builds — issue store credit each time a customer's lifetime spend passes another threshold.

A threshold automation rewards **cumulative spending**. Each time a customer's lifetime spend passes another threshold, they earn store credit — for example **$10 for every $500 they spend**, again at $1,000, at $1,500, and so on.

Unlike an order-value automation, which looks at a single order, a threshold automation looks at everything a customer has ever spent with you. And unlike a scheduled automation, each threshold is rewarded **exactly once**.

{% hint style="info" %}
**Threshold automations are available on the Grow and Pro plans.** On the Free plan they appear greyed out in the **Add automation** picker, labelled **Grow & Pro**, with a **See plans** button. See [plans & billing](/stork-credit/reference/plans-and-billing.md).
{% endhint %}

## Creating a rule

Click **Add automation** and choose **Spend Threshold**.

{% hint style="info" %}
A store can have **one threshold automation at a time**. Every rule shares a single record of each customer's progress, so a second rule would interfere with the first.
{% endhint %}

## Thresholds

| Field                  | Meaning                                                                                                                                                 |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Issue credit every** | The spending interval between rewards — e.g. `$500`.                                                                                                    |
| **Credit amount**      | What the customer receives each time they pass one — e.g. `$10`.                                                                                        |
| **Stop after**         | Lifetime spend above which no more credit is issued. Fills in automatically at 100 rewards' worth; you can lower it, but not clear it or set it higher. |

{% hint style="warning" %}
A rule rewards at most **100 levels**, so **Stop after** can never sit above `first threshold × 100` — a `$500` threshold tops out at `$50,000` of lifetime spend, a `$5` threshold at `$500`. When you change the threshold amount, **Stop after** follows unless you have lowered it yourself. Lower it whenever you want rewards to end sooner. A customer past the **Stop after** amount keeps the credit they have earned but receives no more. The form shows the exact figure as you type.
{% endhint %}

**Notify customers by email** is on by default and sends Shopify's standard store credit email. You can send your own [Store Credit Alert](/stork-credit/emails/email-templates.md#sending-the-store-credit-alert) email instead, which counts toward your monthly email allowance. Turn it off for silent top-ups.

When **Wait before issuing** is on, each held reward is emailed the way the rule was set when the reward started its wait, even if you change the setting before the credit is issued.

Store credit expiry works exactly as it does elsewhere — see [Settings reference](/stork-credit/reference/settings.md).

{% hint style="info" %}
**The threshold amount and Stop after are locked while the rule is active.** Every customer's saved progress is measured against them, so changing them on a live rule would leave that progress meaningless. To change them: deactivate the rule, make the change, re-baseline progress (see below), then reactivate. The reward amount and audience can be changed at any time.
{% endhint %}

## What happens when you activate a rule

When you switch a threshold rule on, Stork Credit records where every existing customer currently sits. **No credit is issued for thresholds they already passed.**

A customer who has already spent $2,400 is simply recorded as being on their way to $2,500. They are not given four rewards for their history. Their next reward comes when they cross $2,500.

The confirmation dialog tells you how many eligible customers this will record before you commit. On most stores the recording finishes within the activation itself and a short summary appears once it's done; on a large store it continues in the background and its progress — *"recorded 800 of 3,200"* — shows on the run in **Run history**.

{% hint style="warning" %}
Because activation deliberately skips past thresholds, there is no way to retroactively reward a customer's existing spending with this automation. If you want to run a catch-up campaign, use a [scheduled automation](/stork-credit/automations/scheduled-automations.md) with a customer query once, then activate the threshold rule.
{% endhint %}

### If recording gets stuck

Recording normally completes within a few minutes. If a rule stays on *"Existing customers are still being recorded"* for longer, open **Settings → Retry seeding** and run it again. It records every customer that is still missing, reports the result, and issues no store credit. Customers already recorded are left as they are.

## Deactivating and reactivating

Deactivating stops the daily runs. Past rewards are never reversed, and Stork Credit's record of which thresholds have already been paid is kept, so no one can be paid twice for a threshold they've already earned.

Deactivating **clears the recorded baseline**. When you reactivate, Stork Credit re-records every eligible customer:

* Customers who already had a recorded position **keep it** — they resume from exactly where they were.
* Anyone missing a position (added to the audience since, or missed the first time) is recorded at their current spend, with no credit for past thresholds.

This is what makes toggling a rule off and on a reliable way to restart recording if it ever gets stuck.

## Re-baselining progress

If you change the threshold amount or the cap, or if customer progress ever looks wrong, use **Settings → Re-baseline threshold progress**. It re-records every eligible customer at their current lifetime spend, issues no store credit, and appears in **Run history** as its own entry.

Re-baselining overwrites all saved progress: a customer part-way to their next reward starts that step again. Past rewards are never reversed, and the record of which thresholds have already been paid is kept — a re-baseline cannot cause the same threshold to be rewarded twice. After changing the threshold amount or the cap, a re-baseline is required before the rule can be reactivated — reactivating alone re-records missing customers but does not correct positions measured against the old threshold amount.

## Passing several thresholds at once

A customer can cross more than one threshold with a single purchase, and they are rewarded for **all** of them.

With a `$500` threshold and a `$10` reward:

| Customer                             | Result                           |
| ------------------------------------ | -------------------------------- |
| New customer places one $1,200 order | Passes $500 and $1,000 → **$20** |
| Customer goes from $450 to $520      | Passes $500 → **$10**            |
| Customer goes from $520 to $980      | Passes nothing → **no credit**   |

## What counts as lifetime spend

Stork Credit uses the **Amount spent** figure Shopify keeps on each customer — the same number you see on their customer page and can filter customer segments by. A few things follow from that:

* It counts **paid** orders only. An unpaid or draft order does not move a customer toward their next threshold until it is paid.
* It **includes tax and shipping**, because Shopify's figure is the order total, not the product subtotal.
* It **goes down when you refund** an order.
* Shopify updates it a short while after an order is paid, not instantly — so a customer who has just checked out may not be picked up until the following run.

## Each threshold is rewarded once — even if a run is interrupted

Stork Credit keeps its own record of every threshold it has paid a customer. If a run credits someone and is then interrupted before it finishes, the next run sees that the reward was already issued and does **not** pay it again — it just tidies up the customer's progress. You never need to worry about a retried or overlapping run double-paying.

## Audience

By default every customer is included. You can narrow the rule to a **hand-picked list of customers**, a **saved Shopify segment**, or a **customer query** — for example to exclude wholesale accounts:

```
NOT customer_tags CONTAINS 'wholesale'
```

Membership is checked at run time, so customers who join the segment later are included automatically. A hand-picked list is fixed — only the customers you chose are ever considered, which makes it a good way to trial a rule on a couple of test accounts before opening it up.

{% hint style="info" %}
Narrowing the audience does not erase anyone's progress. A customer you exclude keeps their saved position, and if you include them again later they carry on from where they were — with credit for any thresholds they passed in the meantime. A customer who is brand new to the rule is recorded at their current spend, with no credit for past thresholds, exactly as at activation.
{% endhint %}

## Schedule

Threshold rules check for newly-passed thresholds on a repeating cycle — **daily is recommended**. Credit is issued on the next run after a customer passes a threshold, not the instant their order is paid.

Choose a start date, a time, and a time zone, then set how often the check repeats.

## Holding credit before it is issued

By default credit is issued on the next run after a customer passes a threshold. If you would rather give refunds time to land first, turn on **Wait before issuing credit** and choose how long to wait — in **hours** or **days**. Fourteen days is a common choice, because it covers most return windows.

While a reward is waiting, nothing has been issued and the customer cannot spend it. When the wait is over, the customer's lifetime spend is checked again:

| At the end of the wait                        | Result                                                                            |
| --------------------------------------------- | --------------------------------------------------------------------------------- |
| Still above the threshold they passed         | Credit is issued as normal                                                        |
| Refunded back below it                        | Credit is **not** issued, and their progress is rewound so they can earn it again |
| Passed two thresholds, refunded back past one | Paid for the threshold they kept, not the one they lost                           |

Their progress moves forward as soon as they pass a threshold, not when the credit is finally issued. That is what stops the same threshold being rewarded twice while credit is waiting — and it means a customer who keeps buying during the wait still earns their next reward normally.

{% hint style="info" %}
Store credit expiry is counted from the day the credit is **issued**, not from the day the threshold was passed. A 14-day hold with a 12-month expiry gives the customer their full 12 months.
{% endhint %}

The longest hold is 180 days.

## Refunds and returns

A customer's lifetime spend falls when they are refunded. Once credit has been **issued**, it is not taken back and their progress is not rewound — a customer who is refunded below a threshold they already passed will not be rewarded for it a second time.

Refunds that land while credit is still waiting are the exception: see [Holding credit before it is issued](#holding-credit-before-it-is-issued) above. A hold is the only way to stop a refunded order paying out.

For how refunds and issued credit show up in your finance reporting, see [Store credit for finance](/stork-credit/reports/store-credit-for-finance.md#refunds-cancellations-and-clawback).

## Showing progress on your storefront

Stork Credit keeps each customer's next target on their customer record, in a field your theme can read. That lets you show a logged-in customer how close they are — *"spend $80 more to earn your next $10"*, a progress bar on the account page, or a nudge in the cart.

The field is called **Next store credit threshold**, and it's created and kept up to date automatically once you activate a threshold rule. You can see it on any customer under **Customers → (a customer) → Metafields**.

For the Liquid snippets and the things that catch people out, see [Threshold progress on your storefront](/stork-credit/integrations/threshold-progress-on-your-storefront.md). To show the same progress at checkout instead, add the **Threshold widget** — see [Cart & checkout widgets](/stork-credit/integrations/storefront-and-checkout.md#threshold-widget).

{% hint style="info" %}
Threshold rewards never appear in the **Cart widget** or **Checkout widget** — those show what the **current cart** will earn, and a threshold reward comes from lifetime spend instead. For the same progress shown at checkout, add the dedicated **Threshold widget**. See [Cart & checkout widgets](/stork-credit/integrations/storefront-and-checkout.md#threshold-rewards-and-the-widgets).
{% endhint %}

## Run history

Each run records how many customers were checked, how many were credited, and how many thresholds were passed in total. With a hold turned on you will see two kinds of run: one that records how many rewards were **held**, and a later one that records how many were **released**, and how many were cancelled because of a refund. See [Run history](/stork-credit/automations/run-history.md).
