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

# Personalised Discount Codes

> Customise Shopify discount codes with the referrer's name using template tokens.

When a reward uses the **Created in Mention Me** Shopify fulfilment option (Mention Me creates the discount in your store), you can personalise the generated codes using template tokens. This makes codes more memorable and brand-aligned - for example, `THANKS-SAM20` instead of a random string.

<Note>
  Personalised templates only apply to the **Created in Mention Me** option. If a reward is **Managed in Shopify** (you pre-create the discount and link it), you set codes in Shopify instead. See the [Shopify fulfilment guide](/knowledge/referral/offers/shopify-fulfilment) for the difference between the two options.
</Note>

<Note>
  This page covers discount code templates for the **Referral** product. For influencer discount code templates, see [Setting Up Automatic Shopify Discount Code Generation](/knowledge/influencer/incentives/shopify-discount-setup).
</Note>

## Available tokens

Combine these tokens with free text to build your template:

| Token                   | Description                                                 | Example output |
| ----------------------- | ----------------------------------------------------------- | -------------- |
| `{REFERRER_FIRST_NAME}` | The referring customer's first name                         | `SAM`          |
| `{REFERRER_LAST_NAME}`  | The referring customer's last name                          | `SMITH`        |
| `{REFERRER_NAME}`       | The referring customer's full name (first + last, no space) | `SAMSMITH`     |
| `{AMOUNT}`              | The discount amount (numeric rewards only)                  | `20`           |

All tokens resolve to **uppercase**, and spaces and special characters (other than hyphens and underscores) are removed automatically.

## Example templates

| Template                            | Generated code      |
| ----------------------------------- | ------------------- |
| `{REFERRER_FIRST_NAME}{AMOUNT}`     | `SAM20`             |
| `THANKS-{REFERRER_NAME}{AMOUNT}`    | `THANKS-SAMSMITH20` |
| `{REFERRER_FIRST_NAME}-VIP`         | `SAM-VIP`           |
| `SAVE{AMOUNT}-{REFERRER_LAST_NAME}` | `SAVE20-SMITH`      |

## How token values are resolved

The tokens always resolve to the **referring customer's** name - that is, the person who made the referral, not the friend who was referred.

* For a **referee reward** (the friend's discount code), the system walks back to the referrer who introduced them.
* For a **referrer reward** (the advocate's own reward), the system uses their own name.

Name values come from the customer's parsed first name and surname as stored in Mention Me. If a name is blank, the token renders as empty.

<Warning>
  There are no `{REFEREE_*}` tokens. The standard Shopify referral flow only captures the friend's email address, so referee name tokens cannot resolve reliably. They may be introduced in a future update.
</Warning>

## Collision handling

If a generated code already exists in Shopify, Mention Me automatically appends a random 6-letter suffix to make it unique. For example, if `SAM20` is taken, the code might become `SAM20QRTVWZ`.

If a name token is blank (the customer has no name on file), the suffix alone forms the code, ensuring every discount code is non-empty.

## Template length

Templates can be up to **128 characters** long. The token placeholders (e.g. `{REFERRER_FIRST_NAME}`) count towards this limit, but the actual rendered code will typically be shorter since names replace the longer placeholder text.

## Non-numeric amounts

The `{AMOUNT}` token only renders for numeric reward values (e.g. 10, 20). For description-based rewards (e.g. "a free handbag"), `{AMOUNT}` renders as empty. Decimal amounts have their separator stripped, so `5.99` renders as `599`. Plan your template accordingly if you use non-monetary or fractional rewards.

## Related

* [Shopify reward fulfilment](/knowledge/referral/offers/shopify-fulfilment)
* [How to Set Up a Reward](/knowledge/referral/offers/setup-reward)
* [Reward Fulfilment](/knowledge/referral/offers/fulfilment)
* [Shopify Overview](/knowledge/shopify/overview)
