# Template Variables

Tebex supports a wide range of **template variables** for use within **custom templates** (written in Twig). These variables allow you to access and display dynamic content such as store details, basket contents, package info, and checkout status.

> Template variables are only available when you're using **Custom Templates**, which require a **Tebex Plus** subscription.

***

### Global Variables (Available Across All Pages)

#### **Store Variables**

| Variable                 | Description                                      |
| ------------------------ | ------------------------------------------------ |
| `store.plan`             | The ID of the plan the store is subscribed to.   |
| `store.branding`         | Whether Tebex branding should be displayed.      |
| `store.name`             | The name of the store.                           |
| `store.currency`         | The currency used by the store.                  |
| `store.googleAnalytics`  | Google Analytics code (if set).                  |
| `store.theme`            | The ID of the active theme.                      |
| `store.css`              | The CSS for the active theme.                    |
| `store.logo`             | The URL of the store logo.                       |
| `store.allowFreeBaskets` | Whether free baskets are allowed.                |
| `store.categories`       | Array of categories in the store.                |
| `store.currencies`       | Array of enabled currencies.                     |
| `store.userMessage`      | Message shown to the user (e.g., success/error). |
| `store.pages`            | Array of custom pages on the store.              |
| `store.locales`          | Available language/locale options.               |

***

#### **Basket Variables**

| Variable           | Description                            |
| ------------------ | -------------------------------------- |
| `basket.username`  | Username of the logged-in player.      |
| `basket.ign`       | Alias of `basket.username`.            |
| `basket.uuid`      | UUID/ID of the logged-in player.       |
| `basket.currency`  | Currency code used in the basket.      |
| `basket.price`     | Total price of the basket.             |
| `basket.packages`  | Array of packages added to the basket. |
| `basket.coupons`   | Array of coupons applied.              |
| `basket.id`        | ID of the basket.                      |
| `basket.copy_link` | Shareable basket URL.                  |

***

#### **Miscellaneous**

| Variable  | Description                      |
| --------- | -------------------------------- |
| `modules` | Raw HTML of the sidebar modules. |

***

### Package Modal Variables

Used within the **package modal popup** context.

| Variable                      | Description                                             |
| ----------------------------- | ------------------------------------------------------- |
| `package.id`                  | ID of the package.                                      |
| `package.name`                | Name of the package.                                    |
| `package.description`         | Package description.                                    |
| `package.price`               | Price of the package.                                   |
| `package.type`                | Type: single purchase or subscription.                  |
| `package.customPrice`         | Whether the customer can enter a custom price.          |
| `package.purchasable`         | If the package can be purchased by the player.          |
| `package.basket`              | Whether the package is already in the basket.           |
| `package.disable_gifting`     | Whether gifting is disabled on this package.            |
| `package.storeGiftingEnabled` | Whether gifting is enabled store-wide.                  |
| `package.image.url`           | URL of the package image.                               |
| `package.image.uploaded`      | If a custom image was uploaded.                         |
| `package.discount`            | Array of applicable discount data.                      |
| `package.reason`              | Reason the package cannot be purchased (if applicable). |

***

### Checkout Flow Variables

| Variable                       | Description                                        |
| ------------------------------ | -------------------------------------------------- |
| `checkout.requiredFields`      | Array of required fields in the checkout process.  |
| `checkout.gateways`            | Array of available payment gateways.               |
| `checkout.unavailableGateways` | Array of disabled or unavailable payment gateways. |

***

### Tips

* These variables can be used inside your **Twig templates** with double curly braces:

  ```twig
  twigCopyEdit{{ store.name }}
  {{ basket.price }}
  ```
* Always check for availability before outputting optional data (e.g. `package.discount`) using Twig conditionals:

  ```twig
  twigCopyEdit{% if package.discount %}
    <p>Discount applied!</p>
  {% endif %}
  ```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tebex.io/creators/tebex-control-panel/webstore/appearance/template-variables.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
