> For the complete documentation index, see [llms.txt](https://docs.optis.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.optis.me/swatch/global-settings/automatic-badges.md).

# Automatic badges

✨Demo product: [Automatic badges](https://optis-color-swatch-variant.myshopify.com/products/floral-summer-dress?variant=48003251372169) (password: 1)

**Automatic badges** show a label on swatches based on a store-wide rule, with no manual assignment. Turn each one on in **Global settings → Automatic badges**.

{% hint style="info" %}
This is different from the manual badges on the [Variant badges](/swatch/variant-badges/variant-badges-overview.md) page, which you assign value by value.
{% endhint %}

## Badge types

<table><thead><tr><th width="140">Badge</th><th>When it shows</th><th>Setting</th></tr></thead><tbody><tr><td><strong>Sold out</strong></td><td>The variant is out of stock (0 available)</td><td>No extra setup — just enable it</td></tr><tr><td><strong>Low stock</strong></td><td>The value's total stock is above zero and below a threshold you set</td><td><strong>Threshold</strong> — a number from 1 to 9999 (default <strong>5</strong>)</td></tr><tr><td><strong>New</strong></td><td>The product was created within the last N days</td><td><strong>Days</strong> — a number from 1 to 365 (default <strong>30</strong>)</td></tr><tr><td><strong>On sale</strong></td><td>The value's compare-at price is higher than its current price</td><td>No threshold — detected automatically from pricing</td></tr></tbody></table>

Each badge is turned on and configured independently — you can enable any combination of the four.

## Set up a badge

{% stepper %}
{% step %}

#### Go to **Global settings** → **Automatic badges**

<figure><img src="https://4026661835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F50cmOdvfYj3qqQaTzKEI%2Fuploads%2Fhsd2EIMLNs7QqeONVc51%2Fimage.png?alt=media&amp;token=ddb19ddc-fae7-41cc-85ba-daf3476eba6c" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Turn on the badge you want (Sold out / Low stock / New / On sale)

For **Low stock**, set the stock **threshold**

<figure><img src="https://4026661835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F50cmOdvfYj3qqQaTzKEI%2Fuploads%2FQjhrmbuify3wZ9jEupHk%2Fimage.png?alt=media&amp;token=c9297baf-31ab-432b-bb5d-93ead1e4b99c" alt=""><figcaption></figcaption></figure>

For **New**, set how many **days** after creation the badge should show

<figure><img src="https://4026661835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F50cmOdvfYj3qqQaTzKEI%2Fuploads%2Fn4oyCjY4ZznKkvAXdSdU%2Fimage.png?alt=media&amp;token=b0be1927-5453-4423-a72d-5675f449037f" alt=""><figcaption></figcaption></figure>

**Sold out** and **On sale** need no extra setup.
{% endstep %}

{% step %}

#### Choose what happens when a value already has a manual badge

* **Keep the manual badge** — the manual badge keeps showing.
* **Override** — the automatic badge replaces the manual badge while its condition is true, and the manual badge reappears once it isn't.
  {% endstep %}

{% step %}

#### Customize the appearance

Set the badge **text**, **text color**, **background color**, **position**, and **shape** — the same options as a manual badge.
{% endstep %}

{% step %}

#### Click **Save**

{% endstep %}
{% endstepper %}

{% hint style="warning" %}
A value can only show one badge at a time. If more than one automatic condition is true (for example a value is both low stock and on sale), only one badge shows.
{% endhint %}
