# Custom Variables

## What Are Custom Variables?

Custom Variables allow you to collect additional input from customers at checkout. This can include:

* Dropdown selections (e.g. server region, item color)
* Text input (e.g. username, tag)
* Numeric input (e.g. levels, amounts)

These values can be used dynamically in your product commands and templates, giving you much more flexibility without needing separate products.

***

## Creating a Custom Variable

To get started:

1. Navigate to the **Custom Variables** tab in your dashboard.
2. Click the **New custom variable** button.

You’ll be prompted to enter the following:

* **Name**: Displayed to customers.
* **Identifier**: Used in commands as `{identifier}`.
* **Description** *(optional)*: Appears under the input on the product page.
* **Type**: Choose between:
  * **Dropdown** – Add multiple options, each with optional extra cost.
  * **Text** – Freeform input. Supports regex validation.
  * **Number** – Numeric input. Also supports regex validation.

***

#### Example Usage in Command

Let’s say you’ve added the following custom variables:

* `{kit}` (Dropdown – e.g. bronze, silver, gold)
* `{name}` (Text – e.g. “Lord”)
* `{slots}` (Number – e.g. 6)

You can reference these in your command like so:

```bash
oxide.usergroup add {customer.steam.id} {kit}
say "{customer.name} just purchased the {kit} package!"
o.grant user {customer.steam.id} backpacks.size.{slots}
```

If the customer selects:

* **Kit**: `gold`
* **Name**: `Lord`
* **Slots**: `6`

Your executed commands will be:

```bash
oxide.usergroup add 7656119XXXXXXXXXXX gold
say "Lord just purchased the gold package!"
o.grant user 7656119XXXXXXXXXXX backpacks.size.6
```

This setup is ideal for selling VIP ranks, timed perks, or custom packages in Rust stores.

***

### Pricing Options (Dropdown Only)

For **dropdown** variables, you can define:

* **Name/Value**: Shown to the customer and used in commands.
* **Pricing Type**: Fixed or Percentage.
* **Additional Cost**: Charge extra for certain options if needed.

***

## Notes

* These variables are optional. If not filled, they will not be injected.
* Regex validation helps ensure valid input for **Text** and **Number** types.
