> 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/order-value-automations.md).

# Order-value automations

Rules that issue store credit when an order is paid or fulfilled — every field on the form, and exactly how the credit amount is calculated.

An order-value automation runs **every time an order is paid**. It checks the order against your conditions and, if they all pass, credits the customer — straight away, or once the order is fulfilled or a wait you set has passed.

This is the rule type behind cashback ("2% back on every order"), spend thresholds ("spend €100, get €10"), and product-specific rewards.

## Creating a rule

From the home page or the **Automations** list, click **Add automation** and choose **Order value**. Or click **Browse all templates** to start from a pre-filled rule.

Rules save as **inactive**. Activate them from the automations list when you're ready — only active rules run.

## Reward

### Credit type and amount

| Credit type      | What the customer gets                     |
| ---------------- | ------------------------------------------ |
| **Fixed amount** | The same amount on every qualifying order  |
| **Percentage**   | A percentage of the qualifying order value |

Percentage rewards are rounded to two decimal places.

### Calculation base

This decides **which order value** the percentage is taken from, and which value the minimum and maximum purchase amounts are compared against.

| Option                                | The base is                                                     |
| ------------------------------------- | --------------------------------------------------------------- |
| **Amount before discounts** (default) | The order value before any discount codes were applied          |
| **Amount after discounts**            | What the customer actually paid, with discount codes subtracted |

{% hint style="info" %}
**Worked example.** An order subtotals €13.20, a 25% discount code takes off €3.30, and the customer pays €9.90. A 2% reward issues **€0.26** on the before-discounts base, or **€0.20** on the after-discounts base.
{% endhint %}

{% hint style="warning" %}
**Rewarding on discounted orders.** The default rewards the full pre-discount value, so a customer using a 25% code still earns as though they paid full price. If you'd rather reward only what was actually paid, switch this to **Amount after discounts** — and check your existing rules, which all use the pre-discount base.
{% endhint %}

The base covers **product discounts only**. Shipping and taxes are never part of it, on either setting.

### Applies to

Limits which line items count toward the reward.

* **All products** — the whole order.
* **Specific collections** — only line items whose product is in one of the collections you pick.
* **Specific products** — only the product variants you pick.

When a rule is limited, only the matching line items count. An order with €200 of matching products and €50 of everything else is treated as a €200 order by that rule. If nothing on the order matches, the rule is skipped.

## When credit is issued

By default a rule credits the customer as soon as the order is paid. In the **Issuing** card you can hold the credit back instead, for example until your return window has closed, so customers can't spend credit on an order they then send back.

| Issue credit                               | Credit is issued                          |
| ------------------------------------------ | ----------------------------------------- |
| **As soon as the order is paid** (default) | When the order is paid                    |
| **When the order is fulfilled**            | Once every item in the order is fulfilled |

Turn on **Wait before issuing** to add a delay of a set number of hours or days, up to 180 days. The wait counts from when the order is paid, or from when it is fulfilled if you chose **When the order is fulfilled**. For example, **When the order is fulfilled** with a 30-day wait issues credit 30 days after the order ships.

{% hint style="info" %}
**Delayed credit options are a paid feature.** On the Free plan the **Issuing** card is greyed out, with a badge naming the plan that includes it. If your store moves to a plan without them, rules that already wait start issuing credit as soon as the order is paid, and credit that is already held is still issued when its wait ends. See [Plans & billing](/stork-credit/reference/plans-and-billing.md).
{% endhint %}

### Decided when the order is paid

Whether an order earns credit is decided when it is paid, exactly as for a rule that issues straight away: active dates, eligibility, uses per customer, applies to, minimum and maximum, credit value and [promotion stacking](/stork-credit/automations/promotion-stacking.md). The order then appears in [Run history](/stork-credit/automations/run-history.md) as **Held**, with the amount and when it will be issued.

### Checked again before it is issued

When the wait ends, Stork Credit reads the order again before issuing anything.

* **The order was cancelled, fully refunded or its payment voided** — nothing is issued.
* **Items were refunded** — the rule is worked out again on the items the customer kept, using the rule's settings from when the order was paid. The credit can go down but never up. If what's left no longer meets the rule's minimum, nothing is issued.
* **The order no longer has a customer** — nothing is issued.

Eligibility isn't checked again, so a customer who leaves a segment or loses a tag during the wait still receives the credit. Refunds that aren't tied to items, such as a goodwill amount or refunded shipping, don't change the credit.

Once credit is issued, a later refund or cancellation doesn't take it back. See [Store credit for finance](/stork-credit/reports/store-credit-for-finance.md#refunds-cancellations-and-clawback) for how this shows up in your reporting.

Credit that is cancelled shows in Run history as a **Skipped** run with the reason. On a **Once per customer** rule, cancelled credit doesn't use up the customer's reward, so a later order can still earn it.

The customer email is sent when the credit is actually issued, and an **After a period** expiry counts from that day, so a wait never shortens how long the customer has to spend it.

### Waiting for fulfillment

* An order counts as fulfilled once **every** item is fulfilled — the order shows as **Fulfilled** in Shopify. A partially fulfilled order keeps waiting.
* **Orders you never mark as fulfilled never earn credit.** If you sell digital products or offer local pickup, check that those orders are marked fulfilled.
* An order that is already fulfilled when it is paid, such as a point-of-sale order, starts its wait straight away.
* An order fulfilled before it is paid earns nothing until it is paid: the rule runs on payment.
* An order still not fulfilled 180 days after it was paid stops waiting, and its credit is cancelled.

### Changing or deleting a rule while credit is held

* **Editing** — credit already held keeps the rule's settings from when the order was paid, including its wait. Your changes apply to orders paid after you save.
* **Deactivating** — credit already held is still issued when its wait ends. New orders aren't evaluated.
* **Deleting** — credit the rule is still holding is cancelled and never issued.

{% hint style="warning" %}
**Tell customers when to expect it.** The [checkout widget](/stork-credit/integrations/storefront-and-checkout.md) says when credit will be added, for example *"added to your account once your order ships"*. If your cart block text promises credit straight away, update it. The amount shown in the order confirmation email is the estimate made at checkout: if items are refunded before the credit is issued, the customer receives less than the email showed.
{% endhint %}

## Eligibility

Decides **which customers** the rule applies to.

| Option                           | Who qualifies                                        |
| -------------------------------- | ---------------------------------------------------- |
| **All customers**                | Anyone with a customer account on the order          |
| **Specific customer segments**   | Members of one Shopify customer segment              |
| **Specific customers**           | A hand-picked list of customers                      |
| **Customers with specific tags** | Customers carrying one of the customer tags you list |

{% hint style="warning" %}
**Store credit needs a customer record.** When someone checks out as a guest, Shopify matches the order to a customer by the email they entered, or creates a new customer, and that customer is credited. To spend the credit, the guest signs in with the same email. An order with no customer at all can't be credited: with **All customers** it records a failed run reading *"No customer ID found"*, and with any other option a skipped run reading *"No customer on order"*.
{% endhint %}

Segment membership is checked live at the moment the order is paid, so a customer who joined the segment yesterday qualifies today.

### Customers with specific tags

Add one or more customer tags. A customer qualifies if they carry **any** of them. Choose how the tags are compared:

| Match               | Qualifies when a customer tag… | Example                                                               |
| ------------------- | ------------------------------ | --------------------------------------------------------------------- |
| **Tag is exactly**  | is the same as one you listed  | `VIP` matches `VIP`, not `VIP-2025`                                   |
| **Tag starts with** | begins with one you listed     | `referral:` matches `referral:SUMMER25` and every other referral code |

Matching ignores upper and lower case. Tags are read from the customer at the moment the order is paid, so a tag added seconds before checkout still counts. This makes tags the reliable choice for rewards triggered at checkout, such as [referral codes](/stork-credit/automations/referral-codes.md). A segment built on the same tag can take a while to update.

{% hint style="info" %}
**Pair tags with "Once per customer".** Tags usually stay on a customer. A rule that rewards a tag on **every qualifying order** keeps paying out on every future order. To reward the tag just once, set **Uses per customer** to **Once per customer**.
{% endhint %}

## Minimum and maximum requirements

Both are optional and are measured against the **calculation base**, using only the line items that survived **Applies to**.

* **Minimum purchase amount** — the order must reach this value.
* **Minimum quantity of items** — the order must contain at least this many items.
* **Maximum purchase amount** — the order must not exceed this value. Independent of the minimum, so you can build non-overlapping tiers.

{% hint style="info" %}
**Building tiers.** Give each tier its own rule with a matching min/max window — €0–99 earns 2%, €100–249 earns 5%, €250 and up earns 8%. Set [promotion stacking](/stork-credit/automations/promotion-stacking.md) to **Best value only** so a customer never collects two tiers on one order.
{% endhint %}

## Uses per customer

| Option                               | Behaviour                                                              |
| ------------------------------------ | ---------------------------------------------------------------------- |
| **Every qualifying order** (default) | The customer earns credit on every order that passes the rule's checks |
| **Once per customer**                | Only the customer's first qualifying order earns credit from this rule |

"Once" is counted per rule. If a customer has been rewarded by one rule, other rules can still reward them. A customer is only counted as rewarded once the credit has actually been issued, so a failed credit doesn't use up their reward. Later orders from a customer who has been rewarded are skipped with the reason *"Customer already rewarded by this rule (once per customer)"*.

## Active dates

Optionally limit the rule to a date range with a start and end date, each with its own time and timezone. Leave both empty and the rule runs as long as it is active.

Useful for seasonal promotions you want to set up ahead of time — combine a future start date with an **Active** status and the rule begins on its own.

## Store credit expiry

Controls how long the issued credit lasts.

| Option              | Behaviour                                                                |
| ------------------- | ------------------------------------------------------------------------ |
| **Never expires**   | The credit stays on the account indefinitely                             |
| **After a period**  | Expires a set number of days, weeks, months, or years after it is issued |
| **On a fixed date** | Every credit from this rule expires on the same calendar date            |

**After a period** is relative to each individual credit, so an order in March and an order in June each get their own countdown.

## What happens when an order is paid

For every active order-value rule, in order:

1. **Active period** — is the current time inside the rule's date range?
2. **Eligibility** — does the customer qualify?
3. **Uses per customer** — for a once-per-customer rule, has this customer already been rewarded?
4. **Applies to** — do any line items match?
5. **Minimum requirements** — met?
6. **Maximum amount** — not exceeded?
7. **Credit value** — greater than zero?
8. **Promotion stacking** — if stacking is off, is this the highest-value eligible rule?
9. **Issuing** — the credit is issued, or held if the rule waits for fulfillment or a set time (see [When credit is issued](#when-credit-is-issued)).

The first failed check stops the rule and records a **skipped** run with the reason. Every step is written to the run log, so you can see exactly where a rule stopped. See [Run history](/stork-credit/automations/run-history.md).

## Multiple rules on one order

By default every qualifying rule fires and the customer receives the **sum** of all of them. To issue only the single highest-value reward instead, change the setting in [Promotion stacking](/stork-credit/automations/promotion-stacking.md).

## Notifications

**Notify customers by email** is on by default. Choose which email the customer gets when credit is issued:

* **Shopify's store credit email**, the default
* **Stork Credit email**, your own [Store Credit Alert](/stork-credit/emails/email-templates.md#sending-the-store-credit-alert) template, which counts toward your monthly email allowance

Turn the setting off to issue credit without emailing the customer. Rules created before this setting existed keep sending Shopify's email.

To also show the earned amount inside your own order confirmation email, turn on **Show earned credit in order confirmation email** on the Checkout widget block — see [Cart & checkout widgets](/stork-credit/integrations/storefront-and-checkout.md#showing-the-earned-amount-in-your-order-confirmation-email).

## Editing and deleting

Open a rule from the **Automations** list to edit it. Changes apply to orders paid **after** you save — credit already issued, or already held, is never revisited.

Select rules in the list to activate, deactivate, or delete them in bulk. Deleting a rule removes its run history and cancels any credit it is still holding. Credit it already issued stays with the customer.

{% hint style="warning" %}
Your plan caps how many automations can be **active** at once — one on Free, ten on Grow. Deactivating a rule frees a slot. See [Plans & billing](/stork-credit/reference/plans-and-billing.md).
{% endhint %}
