> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pureclarity.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Product labels and badges

> Show one badge or label on each product in your recommendations, Instant Search results and Checkout Upsell popup, such as "Ordered before", "20% off" or "Vegan"

Product labels put a small badge or label on the products in your recommendations, your Instant Search results and your Checkout Upsell popup. There are two kinds:

* **Badges** are personal to the shopper looking at the product: **Ordered before**, **Viewed before** and **Gets you free delivery**.
* **Labels** describe the product, so every shopper sees them: a discount such as "20% off", stock such as "Only 3 left", pre-order, or your own custom labels such as "Vegan".

Each product shows **one** badge or label, in one place. You choose which wins in **Badge priority**.

Product labels work on every store using PureClarity's v2 script. Set them up in PureClarity under **Product labels**.

## Turn them on

1. Go to **Product labels**.
2. Turn on the badges you want under **Product badges**, and the labels you want under **Labels**.
3. Under **Badge priority**, put them in the order you want, and untick any you don't want on a surface.
4. Under **Where it sits**, click a place on each sketch.
5. Click **Save**.

Stores that had PureClarity before product labels start with every badge and label off, so nothing changes on your store until you turn them on. Stores created since start with the three badges on and the labels off.

## Badges

| Badge | Shown on a product when | Wording to start with |
| - | - | - |
| **Ordered before** | It's in the shopper's last 20 orders within a year, on any device they've logged in on. | Ordered before |
| **Viewed before** | The shopper viewed its product page in the last 60 days. | Viewed before |
| **Gets free delivery** | Adding it takes the shopper's basket to your free delivery amount, set under **Settings › Configuration**. | Gets you free delivery |

Turn each one on or off with its switch, and change its wording, up to 40 characters. Badges take their shape and colours from your theme's own badges or buttons, so they match your store.

When every product in a recommendation would get the same badge, such as **Viewed before** on every product in a recently viewed recommendation, the badge says nothing new, so those products show the next badge or label in your list instead.

## Labels

| Label | Shown on | Wording to start with | Background to start with |
| - | - | - | - |
| **Discount** | Products on sale by at least 1%, where prices show. `[discount]` is replaced with the discount, rounded down to a whole percent. | \[discount]% off | Red `#b91c1c` |
| **In stock** | Products in stock. `[quantity]` is replaced with how many are left, and then shows only on products whose stock you count. | In stock | Green `#166534` |
| **Low stock** | Products with only a few left. `[quantity]` is replaced with how many are left. | Only \[quantity] left | Amber `#b45309` |
| **Out of stock** | Products that can't be bought until they're back in stock. | Out of stock | Grey `#4b5563` |
| **Pre-order** | BigCommerce products whose availability is pre-order, or products your feed marks `PreOrder`. | Pre-order | Blue `#1d4ed8` |
| **Custom labels** | Products whose field has a value you choose. See [Custom labels](#custom-labels). | Your own | Your own |

For each label you can turn it on or off, change its wording, up to 40 characters, and choose its **Background colour** and **Text colour**. Text starts white. The preview beside each label shows how it looks. If the text colour doesn't stand out enough from the background for shoppers to read, the page asks you to choose another before you save.

Some things to know about the stock labels:

* **Low stock** applies to products with a counted stock of 1 up to your **Low stock at or below** level, which is 5 unless you change it, from 1 to 1,000. On BigCommerce, a product's own low stock level is used where you've set one.
* Products whose stock your feed doesn't give, products you've turned purchasing off for, and Shopify products you keep selling when out of stock get no stock label.
* A product on pre-order gets the **Pre-order** label, not **Out of stock** or **Low stock**.
* Recommendations leave out out-of-stock products when you exclude them under **Settings › Configuration**, so the **Out of stock** label is mostly seen in Instant Search. It never shows in the Checkout Upsell popup, which only offers products that can be bought.

In Instant Search, the **Discount** label takes the place of the crossed-out old price.

### Custom labels

Custom labels go on products whose field has a value, such as "Vegan" where the field `_vegan` is `1`. You can add up to 10:

1. Under **Custom labels**, click **Add a custom label**.
2. Enter the **Field**. As you type, it suggests the fields your products have, with how many products have each.
   * **BigCommerce**: a custom field's name.
   * **Shopify**: a metafield, or a tag's name before its colon, such as `Diet` in `Diet:Vegan`.
   * **Other platforms**: an attribute in your product feed.
3. Enter the **Value** to match, such as `1` or `Yes`. Field and value are matched without case.
4. Enter the **Wording** and choose its colours.

Leave the field empty to match a value in the product's tags instead: on BigCommerce a search keyword or the brand, on Shopify a whole tag, the product type, vendor or brand, and on other platforms a search tag or brand.

A product shows the first custom label that matches, in the order you list them.

On BigCommerce and Shopify, PureClarity only stores the fields you include. Go to **Data Explorers › Product fields** to see every field your products have, how many products have each and their most common values, and tick **Include** for the fields your labels use. The next daily product import stores them. Until then, the field shows **Stored on products after the next product import** on the Product labels page.

## Badge priority

**Badge priority** is one list of every badge and label. A product shows the first in the list that it qualifies for and that's ticked for where it shows. Use the arrows to move a row up or down.

Each row has a tick for each surface: **Recommendations**, **Checkout Upsell** and **Instant Search**. Untick one to leave that badge or label out there, and the next in the list shows instead. A badge or label that's turned off is marked **(off)**.

The list starts in this order:

1. Out of stock
2. Pre-order
3. Ordered before
4. Discount
5. Low stock
6. Gets free delivery
7. Custom labels
8. Viewed before
9. In stock

For example, with this order a discounted product the shopper ordered before shows **Ordered before**, and one they only viewed before shows its discount.

## Where it sits

Under **Where it sits**, click a place on the sketch of each surface. Every badge and label on that surface sits there.

| Surface | Places | Starts at |
| - | - | - |
| **Recommendations** | A corner of the image, a strip along the top or bottom of the image, the middle of the image, or under the title. | Image, top left |
| **Checkout Upsell** | A corner of the image, a strip along the top or bottom of the image, or above the title. | Image, top left |
| **Instant Search** | After the price, or under the title. | After the price |

* **Corners** cover the least of the photo. Long wording wraps onto two lines. In the Checkout Upsell popup, whose images are 88px, a corner fits about 12 characters a line.
* **Strips** fit any wording, but cover a band of the photo.
* **The middle** covers the product itself, so it suits one short word, such as "Sold out". The popup doesn't offer it.
* **Under** or **above the title** keeps the photo clear, but makes products with a badge one line taller.
* On themes that show the price on the recommendation's image, bottom places move to the top.
* Instant Search's images are too small for text, so nothing goes on them. **After the price** keeps every result the same height.

## Recommendations

Badges and labels show on recommendations whose template's **Show product badges** setting is on. It's on unless you untick it. To leave badges off one recommendation, untick it in that recommendation's campaign.

They show on PureClarity's own grid templates. If you've made your own template, or copied one, it needs to draw them. See [Custom templates](#custom-templates).

When a recommendation shows the **Discount** label, the card leaves out its "Sale" text.

## Instant Search

Instant Search shows a product's badge or label after its price or under its title, where you placed it. Labels use the colours you chose, and badges take the shape of your theme's own badges.

With a badge ticked for Instant Search, badges come from your Product labels settings, and Instant Search's own **Bought before** and **Viewed before** badges don't show. See [Instant Search](https://docs.pureclarity.com/features/instant-search.md).

## Checkout Upsell

The popup shows a product's badge or label where you placed it. The **Product labels** line on the Checkout Upsell page shows which labels are on there, with a link to this page.

## Shoppers who see no badges

**Shoppers who see no badges (%)** sets the share of shoppers held out of badges, from 0 to 100. It's 5 unless you change it. These shoppers see the next label in your list instead of a badge, and their clicks and orders are still counted as if the product was badged, so the difference badges make can be measured.

Each shopper stays in the same group, including when they log in. Labels aren't personal, so every shopper sees them, including those held out.

## Custom templates

Recommendation templates read a product's one badge or label from its `pcTag` field. It has:

| Field | What it holds |
| - | - |
| `pcTag.text` | The wording to show. Empty for a shopper held out of badges. |
| `pcTag.kind` | Which badge or label it is: `ordered`, `viewed`, `freeDelivery`, `discount`, `inStock`, `lowStock`, `outOfStock`, `preOrder` or `custom`. |
| `pcTag.position` | Where you placed it on recommendations: `topLeft`, `top`, `topRight`, `middle`, `bottomLeft`, `bottom`, `bottomRight` or `belowTitle`. |
| `pcTag.background`, `pcTag.colour` | A label's colours, as `#rrggbb`. Badges have none, so style them as your store's badges. |

`pcDiscount` is set when the product shows the **Discount** label, so your template can leave out its own sale text.

PureClarity's own product card draws it like this, inside the image's wrapper, which has `position: relative`:

```handlebars theme={null}
{{#if (and schema_settings.show_badges this.pcTag.text)}}
    <span class="pc-tag {{#if this.pcTag.background}}pc-label{{else}}pc-badge{{/if}}"
        data-position="{{this.pcTag.position}}" data-kind="{{this.pcTag.kind}}"
        {{#if this.pcTag.background}}style="background-color: {{this.pcTag.background}}; color: {{this.pcTag.colour}};"{{/if}}>{{this.pcTag.text}}</span>
{{/if}}
```

Add a **Show product badges** checkbox to your template's schema, with the id `show_badges`, and turn it on in the campaign. Without it, the recommendation gets no badges or labels. See [Creating templates](https://docs.pureclarity.com/features/templates/creating-templates.md).

## Good to know

* **Stock and field data come from your product import.** New fields and stock show on labels after the next daily product import, or after your next feed on other platforms.
* **Discount labels show only where prices show.** On recommendations, that's where the template shows prices.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.