# 🔖Example: Discount

## Create Conditional Placeholder

Use conditional placeholder with MAX or MIN mode, discount feature can be easily implemented.

Here we created 2 conditional placeholder for `buy` and `sell`.

```yaml
mode: MAX

value:
  default: 1
  vip: 1.5
  mvp: 2

conditions:
  vip:
    1:
      type: permission
      permission: 'group.vip'
  mvp:
    1:
      type: permission
      permission: 'group.mvp'
```

```yaml
mode: MIN

value:
  default: 1
  vip: 0.5
  mvp: 0.3

conditions:
  vip:
    1:
      type: permission
      permission: 'group.vip'
  mvp:
    1:
      type: permission
      permission: 'group.mvp'
```

## Use the placeholder in product configs

```yaml
items:
  A:
    price-mode: CLASSIC_ALL
    product-mode: CLASSIC_ALL
    products:
      1:
        material: sea_lantern
        lore: 
          - '%player_health%'
    buy-prices:
      1:
        economy-plugin: Vault
        amount: '{conditional_buy} * 5' # <--- Changed line
        start-apply: 0
        placeholder: '{amount} Coins'
    sell-prices:
      1:
        economy-plugin: Vault
        amount: '{conditional_sell} * 5' # <--- Changed line
        start-apply: 0
        placeholder: '{amount} Coins'
```

* `5` is base price, then add `{conditional_buy}` or `{conditional_sell}` before it.
* If player meet vip condition, the `{condition_buy}` will return `0.5`, so he will only need pay `0.5*4` which means only `2.5` coins!

## Auto Apply Discount

* Start from 2.3.2, you can auto apply conditional placeholder to all prices! Just configure it in `config.yml` file. This can helps you auto add discount for each products.

```yaml
placeholder:
  auto-settings:
    add-conditional-in-all-price-amount:
      enabled: false
      buy-placeholder: buy
      sell-placeholder: sell
      black-dynamic-price: true
      black-shops:
        - 'example'
```

* It is recommend you disable this feature for dynamic price, if you want to enable it for dynamic price too, just change `black-dynamic-price` option to false here!
* If you want to disable this feature for specified shops, use `black-shops` option.


---

# 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://ultimateshop.superiormc.cn/placeholders/example-discount.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.
