> For the complete documentation index, see [llms.txt](https://docs.samita.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.samita.io/reference/condition-operators-reference.md).

# Condition operators reference

Every condition field and operator available when building targeting rules for badges.

A targeting rule is a row with three parts: a **field**, an **operator**, and a **value**. The operators offered depend on the field you pick — text fields get *contains* and *starts with*, numeric fields get *is greater than*, and so on.

You build these rows on the badge editor's **Products** tab, after selecting **Products matching conditions**.

## Condition fields

The field dropdown is grouped into three sections.

### Product conditions

| Field                     | What it matches                                  |
| ------------------------- | ------------------------------------------------ |
| **Product title**         | The product's name.                              |
| **Product type**          | Shopify's product type field.                    |
| **Product vendor**        | The vendor name.                                 |
| **Product price**         | The current price.                               |
| **Product compare price** | The compare-at price.                            |
| **Product sale price**    | The discounted price.                            |
| **Product option**        | A product option such as size or color.          |
| **Product tag**           | Any tag on the product.                          |
| **Product weight**        | The product's weight.                            |
| **Product created**       | How long ago the product was created, in days.   |
| **Product published**     | How long ago the product was published, in days. |
| **Product inventory**     | Stock level and stock status.                    |
| **Product metafield**     | A product metafield value.                       |

### Variant conditions

| Field                 | What it matches                          |
| --------------------- | ---------------------------------------- |
| **Product variants**  | Whether the product has variants at all. |
| **Variant inventory** | Stock level of individual variants.      |
| **Variant metafield** | A variant metafield value.               |

### Collection conditions

| Field           | What it matches                         |
| --------------- | --------------------------------------- |
| **Collections** | The collections the product belongs to. |

### Discount conditions

| Field             | What it matches                                                                                 |
| ----------------- | ----------------------------------------------------------------------------------------------- |
| **Sami discount** | Products covered by one of the discounts on the app's [Discounts](/discounts/overview.md) page. |

**Sami discount** takes a single operator — **is equal to** — and one discount as its value. Use it to show a badge only while that discount is running, and to fill the badge text with the discount's own numbers through the `{sami_discount_*}` variables. See [Dynamic variables reference](/reference/dynamic-variables-reference.md).

## Operators by field type

### Text fields

Product title, type, vendor, option, tag.

| Operator             | Meaning                               |
| -------------------- | ------------------------------------- |
| **is equal to**      | Exactly matches the value you enter.  |
| **is not equal to**  | Does not match the value.             |
| **starts with**      | Begins with the text you enter.       |
| **ends with**        | Ends with the text you enter.         |
| **contains**         | Includes the text anywhere within it. |
| **does not contain** | Does not include the text.            |

### Numeric fields

Product price, compare price, sale price, weight.

| Operator            | Meaning                              |
| ------------------- | ------------------------------------ |
| **is equal to**     | Exactly the number you enter.        |
| **is not equal to** | Any number except the one you enter. |
| **is greater than** | Above the number you enter.          |
| **is less than**    | Below the number you enter.          |

### Inventory

| Operator                               | Meaning                                       |
| -------------------------------------- | --------------------------------------------- |
| **in stock**                           | The product currently has inventory.          |
| **out of stock**                       | Inventory has reached zero.                   |
| **continue selling when out of stock** | The product is set to keep selling past zero. |
| **stock availability is greater than** | Stock is above the threshold you enter.       |
| **stock availability is less than**    | Stock is below the threshold you enter.       |

The first three take no value — the operator *is* the condition.

### Date fields

Product created, Product published. The value is a number of **day(s)** counted back from today, not a calendar date.

| Operator            | Meaning                                                                         |
| ------------------- | ------------------------------------------------------------------------------- |
| **is less than**    | Created or published fewer than N days ago — use this for "new arrival" badges. |
| **is greater than** | Created or published more than N days ago.                                      |
| **is in range**     | Falls between two day counts.                                                   |

### Product variants

| Operator                              | Meaning                                          |
| ------------------------------------- | ------------------------------------------------ |
| **is equal to** / **is not equal to** | Compares against a specific variant count.       |
| **products with variants**            | The product has more than one variant.           |
| **product has no variants**           | The product has only the single default variant. |

## Combining conditions

Add as many rows as you need with **Add conditions**, then use the **Products must match** radio above them to decide how they combine:

{% columns %}
{% column %}

### all conditions (AND)

Every row must be true. Narrows the match.

**Example:** Product type `is equal to` "T-Shirt" **and** Product vendor `is equal to` "Nike" → only Nike T-shirts.
{% endcolumn %}

{% column %}

### any condition (OR)

One row is enough. Widens the match.

**Example:** Product tag `is equal to` "new-arrival" **or** Product tag `is equal to` "featured" → products with either tag.
{% endcolumn %}
{% endcolumns %}

{% hint style="info" %}
The setting applies to the whole rule — you cannot mix AND and OR within a single set of conditions. Banners use the same pattern on their **Placement** tab.
{% endhint %}

***

## Next steps

* [Target products by attribute](/badges-and-labels/target-by-attribute.md) — set up attribute conditions step by step.
* [Target specific products](/badges-and-labels/target-products.md) — hand-pick individual products instead.
* [Plan comparison](/reference/plan-comparison.md) — check which conditions your plan includes.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.samita.io/reference/condition-operators-reference.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
