> For the complete documentation index, see [llms.txt](https://docs.rafflex.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rafflex.io/advanced/twig-templating/club-variables.md).

# Club Variables

Show your Club tiers, prices, benefits and the visitor's membership anywhere on your site with a Custom Twig Block, or replace your Club page with your own design.

{% hint style="warning" %}
Club is a Rafflex Pro feature in beta and needs card on file enabled on your Cashflows account. These variables are only available once your Club is switched on. See [Club Memberships](https://docs.rafflex.io/club-memberships/club-memberships.md).
{% endhint %}

Club data can be used in two places:

* **A Custom Twig Block** on any page, using the **Club (membership tiers)** variable type. Use this to promote your Club on your homepage or competition pages.
* **A custom Club page**, which replaces the built-in page at `yoursite.com/club`.

***

### In a Custom Twig Block <a href="#custom-twig-block" id="custom-twig-block"></a>

1. Add a [Custom Twig Block](https://docs.rafflex.io/advanced/twig-templating/custom-twig-block.md) to a page.
2. Add a variable, name it `club`, and choose the type **Club (membership tiers)**.
3. Use it in your template.

The type only appears in the list while your Club is switched on. If you later switch the Club off, the variable is empty, so always wrap your template in `{% if club.enabled %}`:

```twig
{% if club.enabled %}
  <h2>Join {{ club.name }}</h2>
  {% for tier in club.tiers %}
    <div>
      <h3>{{ tier.name }}: {{ tier.price_display }}</h3>
      <ul>
        {% for benefit in tier.benefits %}
          <li>{{ benefit.description }}</li>
        {% endfor %}
      </ul>
      <a href="{{ tier.join_url }}">Join {{ tier.name }}</a>
    </div>
  {% endfor %}
{% endif %}
```

***

### Custom Club Page <a href="#custom-club-page" id="custom-club-page"></a>

1. Click **Club** in the left-hand menu, then **Advanced** (under **Setup**).
2. Switch on **Use a custom landing page**.
3. Write your template in **Landing page template (HTML + Twig)**. Your site header and footer stay in place around it.
4. Click **Save**.

{% hint style="success" %}
**Let AI build it for you.** In the **Build it with AI** section, click **Copy documentation** and paste it into an AI assistant such as Claude or ChatGPT. It asks you a few questions about the design you want, then gives you a template to paste into the editor. The copied document includes your Club's public details (tiers, prices and benefits, as a visitor would see them), so the assistant can design around them. It contains no customer data.
{% endhint %}

On the custom Club page the data is split into separate variables rather than one `club` variable. Use `club`, `tiers`, `main_competition`, `daily_draw`, `member` and `user` directly (for example `{% for tier in tiers %}`). There is no `club.enabled` here, because the page only shows while the Club is on. Your [Settings Variables](https://docs.rafflex.io/advanced/twig-templating/settings-variables.md) (`settings`) work here too, and the same tags and filters as every other template (see [Filters Reference](https://docs.rafflex.io/advanced/twig-templating/custom-twig-block.md#filters-reference)).

The custom page only appears when **Club enabled** and **Show the Club landing page** are both on in Club Settings.

***

### Club <a href="#club" id="club"></a>

| Variable                    | What it contains                                                            |
| --------------------------- | --------------------------------------------------------------------------- |
| `club.enabled`              | True while the Club is on (Custom Twig Block only).                         |
| `club.name`                 | Your Club display name.                                                     |
| `club.description`          | Your Club description.                                                      |
| `club.url`                  | The link to your Club page. Empty if **Show the Club landing page** is off. |
| `club.terms_url`            | The link to your Club terms, if set.                                        |
| `club.cancellation_wording` | Your cancellation wording, if set.                                          |
| `club.currency_icon`        | Your currency symbol, for example `£`.                                      |
| `club.tiers`                | Your active tiers (see below).                                              |
| `club.main_competition`     | Your linked main competition (see below).                                   |
| `club.daily_draw`           | Your daily draw schedule (see below).                                       |
| `club.member`               | The visitor's own membership (see below).                                   |
| `club.user`                 | The visitor (see below).                                                    |

***

### Tiers <a href="#tiers" id="tiers"></a>

Loop through `club.tiers` (or `tiers` on the custom Club page). Tiers come in the order you set in the admin panel.

| Field                       | What it contains                        | Example       |
| --------------------------- | --------------------------------------- | ------------- |
| `tier.name`                 | Tier name                               | Gold          |
| `tier.description`          | Tier description                        |               |
| `tier.featured_image_url`   | Tier image (empty if none)              |               |
| `tier.price`                | Monthly price                           | £9.99         |
| `tier.price_raw`            | Monthly price as a number               | 9.99          |
| `tier.price_display`        | Monthly price with interval             | £9.99 / month |
| `tier.yearly_enabled`       | Whether yearly billing is offered       | true          |
| `tier.yearly_months_free`   | Months free on yearly                   | 2             |
| `tier.yearly_price`         | Yearly price                            | £99.90        |
| `tier.yearly_price_display` | Yearly price with interval              | £99.90 / year |
| `tier.yearly_per_month`     | Yearly price per month                  | £8.32         |
| `tier.join_url`             | Link for your **Join** button           |               |
| `tier.benefits`             | A list of benefits (see below)          |               |
| `tier.rewards`              | A list of milestone rewards (see below) |               |

**Benefits** (`tier.benefits`)

The easiest field to use is `benefit.description`, a ready written sentence such as "£5.00 site credit each month" or "1 daily draw entry per day".

| Field                 | What it contains                                                                   |
| --------------------- | ---------------------------------------------------------------------------------- |
| `benefit.description` | A ready written sentence describing the benefit.                                   |
| `benefit.type`        | `site_credit`, `competition_entries`, `cashback` or `reward`.                      |
| `benefit.cadence`     | `per_payment`, `daily`, `per_order` (cashback) or `milestone` (milestone rewards). |
| `benefit.quantity`    | Number of entries (entries only).                                                  |
| `benefit.amount`      | Credit amount, for example £5.00 (site credit only).                               |
| `benefit.percentage`  | Cashback rate, for example 5% (cashback only).                                     |
| `benefit.cap`         | Monthly cashback cap, empty if none (cashback only).                               |

{% hint style="info" %}
`tier.benefits` already includes the tier's milestone rewards (as sentences such as "Tartan gift after 6 paid months"). If you also list `tier.rewards` separately, skip them in your benefits loop with `{% if benefit.type != 'reward' %}`, or each reward appears twice.
{% endhint %}

**Rewards** (`tier.rewards`)

| Field                | What it contains                       |
| -------------------- | -------------------------------------- |
| `reward.title`       | The reward, for example "Tartan gift". |
| `reward.threshold`   | Paid months needed to earn it.         |
| `reward.description` | The reward description, if any.        |

***

### Main Competition <a href="#main-competition" id="main-competition"></a>

`club.main_competition` (or `main_competition`) is your linked main competition, with the same fields as a competition in the [Products](https://docs.rafflex.io/advanced/twig-templating/custom-twig-block.md#products) variable, such as `title`, `url`, `image_url`, `draw_date` and [`promotion`](https://docs.rafflex.io/advanced/twig-templating.md#promotions). It is empty if no competition is linked. Check `is_active` before promoting it.

***

### Daily Draw <a href="#daily-draw" id="daily-draw"></a>

| Field                   | What it contains                | Example                                                |
| ----------------------- | ------------------------------- | ------------------------------------------------------ |
| `daily_draw.enabled`    | Whether a daily draw is running | true                                                   |
| `daily_draw.name`       | The daily draw name             | Daily Cash Draw                                        |
| `daily_draw.entry_time` | When entries are added          | 9:00am                                                 |
| `daily_draw.draw_time`  | When it is drawn                | 8:00pm                                                 |
| `daily_draw.rhythm`     | A ready written sentence        | Entries are added daily at 9:00am and drawn at 8:00pm. |

In a Custom Twig Block, use `club.daily_draw`.

***

### The Visitor's Membership <a href="#member" id="member"></a>

`club.member` (or `member`) describes the person viewing the page, so you can show different content to members and non-members.

| Field                   | What it contains                                                                                                                                                           |
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `member.is_member`      | True if they hold a membership that has not ended. This includes a join still being confirmed, a failed payment and a suspended membership. Use it to decide what to show. |
| `member.status`         | The membership status: `pending`, `active`, `past_due` (payment failed), `suspended`, `cancelled` or `expired`.                                                            |
| `member.tier_name`      | Their tier.                                                                                                                                                                |
| `member.payment_failed` | True if their last payment failed. Keep showing **Join** buttons, so they can rejoin with a new card.                                                                      |
| `member.is_comp`        | True if it is a free membership you gave them.                                                                                                                             |
| `member.comp_until`     | When their free membership ends (empty if it does not end).                                                                                                                |
| `member.my_club_url`    | Link to their My Club page.                                                                                                                                                |

```twig
{% if club.member.is_member %}
  <a href="{{ club.member.my_club_url }}">Go to My Club</a>
{% elseif club.url %}
  <a href="{{ club.url }}">Become a member</a>
{% endif %}
```

**The visitor** (`club.user`, or `user`)

| Field               | What it contains                                         |
| ------------------- | -------------------------------------------------------- |
| `user.is_logged_in` | True if they are logged in.                              |
| `user.display_name` | Their name, or "Guest".                                  |
| `user.balance`      | Their site credit balance, formatted (empty for guests). |

***

### AI Context <a href="#ai-context" id="ai-context"></a>

**For AI Assistants:** This documents RaffleX Club (paid membership) data for Twig templates.

**Where it is available:**

* Custom Twig Block: a user variable of type **Club (membership tiers)**, usually named `club`. Only offered while the Club is on; renders empty when the Club is off, so wrap everything in `{% if club.enabled %}`. Nested keys: `club.tiers`, `club.main_competition`, `club.daily_draw`, `club.member`, `club.user`.
* Custom Club landing page (admin: Club, then Advanced): top level variables `club`, `tiers`, `main_competition`, `daily_draw`, `member`, `user`, plus `settings`. No `club.enabled`.

**Shapes:**

* `club`: `enabled`, `name`, `slug`, `description`, `url` (null when the landing page is hidden), `terms_url`, `cancellation_wording`, `currency_icon`
* `tiers[]`: `id`, `name`, `slug`, `description`, `featured_image_url`, `price`, `price_raw`, `price_display`, `yearly_enabled`, `yearly_months_free`, `yearly_price`, `yearly_price_raw`, `yearly_price_display`, `yearly_per_month`, `yearly_per_month_raw`, `join_url`, `benefits[]`, `rewards[]`
* `benefits[]`: `type` (`site_credit`, `competition_entries`, `cashback`, `reward`), `cadence` (`per_payment`, `daily`, `per_order`, `milestone`), `quantity`, `amount`, `amount_raw`, `percentage`, `percentage_raw`, `cap`, `cap_raw`, `description`. Milestone rewards appear here as well as in `rewards[]`.
* `rewards[]`: `title`, `threshold` (paid months), `description`
* `main_competition`: same fields as a Products competition, or null
* `daily_draw`: `enabled`, `name`, `entry_time`, `draw_time`, `rhythm` (null values when no daily draw)
* `member`: `is_member`, `status`, `tier_name`, `tier_slug`, `payment_failed`, `is_comp`, `comp_until`, `my_club_url`
* `user`: `is_logged_in`, `display_name`, `balance`, `balance_raw`

**Key notes:** Same sandbox, tags and filters as the Custom Twig Block. Branch on `member.is_member`, not `member.status`. Keep Join buttons visible when `member.payment_failed` is true. Only promote `main_competition` when `is_active` is true and it has not ended or sold out.
