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

# Conditions

> Filter which events trigger a notification using field-level conditions

## Overview

Conditions are optional filters on a trigger that narrow down which events generate a notification. Without conditions, a trigger fires for every event of its type. With conditions, you can restrict it to specific cases — e.g., only orders over \$200, or only products from a specific vendor.

***

## How Conditions Work

Each condition has three parts:

| Part         | Description              | Example           |
| ------------ | ------------------------ | ----------------- |
| **Field**    | The data point to check  | `Total Inventory` |
| **Operator** | How to compare the value | `Less than`       |
| **Value**    | The threshold or target  | `10`              |

Multiple conditions can be added to a single trigger. When you have more than one condition, you choose how they combine:

| Mode                          | Behavior                                       |
| ----------------------------- | ---------------------------------------------- |
| **All conditions must match** | Every condition must be true (AND logic)       |
| **Any condition can match**   | At least one condition must be true (OR logic) |

If no conditions are set, the trigger fires for all events of its type (subject to change detection for update events).

***

## Operators

**String fields:**

| Operator        | Behavior                                          |
| --------------- | ------------------------------------------------- |
| Equals          | Exact match (case-insensitive)                    |
| Doesn't Equal   | Does not match exactly                            |
| Contains        | Field includes the search text (case-insensitive) |
| Doesn't Contain | Field does not include the search text            |

**Numeric fields:**

| Operator      | Behavior                                    |
| ------------- | ------------------------------------------- |
| Equals        | Exact numeric match                         |
| Doesn't Equal | Not equal                                   |
| Greater than  | Field value is strictly above the threshold |
| Less than     | Field value is strictly below the threshold |

***

## Condition Fields by Entity

### Product

Available for: **Product created**, **Product updated**, **Product deleted**

<AccordionGroup>
  <Accordion title="Basic">
    | Field        | Type   | Description                      |
    | ------------ | ------ | -------------------------------- |
    | Title        | String | Product title                    |
    | Status       | String | `active`, `draft`, or `archived` |
    | Product Type | String | Product type classification      |
    | Vendor       | String | Vendor/manufacturer name         |
    | Tags         | String | Comma-separated product tags     |
    | URL Handle   | String | URL-friendly slug                |
    | Description  | String | Product description (HTML body)  |
  </Accordion>

  <Accordion title="Publication">
    | Field           | Type   | Description                         |
    | --------------- | ------ | ----------------------------------- |
    | Published At    | String | When the product was published      |
    | Published Scope | String | Publication scope (`web`, `global`) |
  </Accordion>

  <Accordion title="Taxonomy & Classification">
    | Field                     | Type   | Description                                         |
    | ------------------------- | ------ | --------------------------------------------------- |
    | Category                  | String | Shopify product category                            |
    | Is Gift Card              | String | Whether the product is a gift card (`true`/`false`) |
    | Requires Selling Plan     | String | Whether a selling plan is required                  |
    | Has Only Default Variant  | String | Whether the product has just one variant            |
    | Has Out-of-Stock Variants | String | Whether any variant is out of stock                 |
    | Collections               | String | Collections the product belongs to                  |
  </Accordion>

  <Accordion title="Pricing & Cost">
    | Field            | Type   | Description                 |
    | ---------------- | ------ | --------------------------- |
    | Price            | Number | Product price               |
    | Compare at Price | Number | Compare-at (original) price |
    | Unit Price       | Number | Per-unit price              |
    | Cost per Item    | Number | Cost of goods per item      |
  </Accordion>

  <Accordion title="Inventory & Shipping">
    | Field             | Type   | Description                             |
    | ----------------- | ------ | --------------------------------------- |
    | Total Inventory   | Number | Sum of inventory across all variants    |
    | Charge Tax        | String | Whether tax is charged (`true`/`false`) |
    | Physical Product  | String | Whether the product requires shipping   |
    | Inventory Tracked | String | Whether inventory tracking is enabled   |
  </Accordion>

  <Accordion title="SEO">
    | Field                | Type   | Description              |
    | -------------------- | ------ | ------------------------ |
    | SEO Page Title       | String | Meta title for SEO       |
    | SEO Meta Description | String | Meta description for SEO |
  </Accordion>
</AccordionGroup>

***

### Order

Available for: **Order created**, **Order updated**, **Order paid**, **Order fulfilled**, **Refund created**

<AccordionGroup>
  <Accordion title="Identification">
    | Field        | Type   | Description                  |
    | ------------ | ------ | ---------------------------- |
    | Order Number | Number | Sequential order number      |
    | Order Name   | String | Display name (e.g., `#1001`) |
  </Accordion>

  <Accordion title="Pricing & Financials">
    | Field                  | Type   | Description                    |
    | ---------------------- | ------ | ------------------------------ |
    | Total Price            | Number | Grand total of the order       |
    | Subtotal Price         | Number | Subtotal before tax/shipping   |
    | Total Discounts        | Number | Total discount amount applied  |
    | Total Tax              | Number | Total tax charged              |
    | Total Line Items Price | Number | Sum of all line item prices    |
    | Total Outstanding      | Number | Amount remaining to be paid    |
    | Total Weight           | Number | Combined weight of items       |
    | Current Total Price    | Number | Current total (after edits)    |
    | Current Subtotal Price | Number | Current subtotal (after edits) |
    | Total Tip Received     | Number | Tip amount                     |
  </Accordion>

  <Accordion title="Status & Contact">
    | Field                      | Type   | Description                           |
    | -------------------------- | ------ | ------------------------------------- |
    | Email                      | String | Email on the order                    |
    | Contact Email              | String | Contact email address                 |
    | Phone                      | String | Phone number                          |
    | Currency                   | String | Order currency code (e.g., `USD`)     |
    | Presentment Currency       | String | Display currency                      |
    | Financial Status           | String | `paid`, `pending`, `refunded`, etc.   |
    | Fulfillment Status         | String | `fulfilled`, `partial`, `unfulfilled` |
    | Display Financial Status   | String | Human-readable financial status       |
    | Display Fulfillment Status | String | Human-readable fulfillment status     |
    | Customer ID                | String | Associated customer ID                |
    | Note                       | String | Order notes                           |
    | Source Name                | String | Where the order originated            |
    | Tags                       | String | Order tags                            |
    | Customer Locale            | String | Customer's locale                     |
    | Cancel Reason              | String | Reason for cancellation               |
    | Landing Site               | String | Landing page URL                      |
    | Payment Gateway Names      | String | Payment methods used                  |
  </Accordion>

  <Accordion title="Flags">
    | Field                   | Type   | Description                       |
    | ----------------------- | ------ | --------------------------------- |
    | Buyer Accepts Marketing | String | Marketing opt-in status           |
    | Test Order              | String | Whether this is a test order      |
    | Tax Exempt              | String | Whether the order is tax exempt   |
    | Taxes Included          | String | Whether prices include tax        |
    | Confirmed               | String | Whether the order is confirmed    |
    | Edited                  | String | Whether the order has been edited |
    | Duties Included         | String | Whether duties are included       |
  </Accordion>

  <Accordion title="Shipping Address">
    | Field              | Type   | Description      |
    | ------------------ | ------ | ---------------- |
    | Shipping City      | String | City             |
    | Shipping Province  | String | Province/state   |
    | Shipping Country   | String | Country          |
    | Shipping Zip       | String | Postal/ZIP code  |
    | Shipping Address 1 | String | Street address   |
    | Shipping Phone     | String | Phone on address |
    | Shipping Name      | String | Name on address  |
  </Accordion>

  <Accordion title="Billing Address">
    | Field             | Type   | Description      |
    | ----------------- | ------ | ---------------- |
    | Billing City      | String | City             |
    | Billing Province  | String | Province/state   |
    | Billing Country   | String | Country          |
    | Billing Zip       | String | Postal/ZIP code  |
    | Billing Address 1 | String | Street address   |
    | Billing Phone     | String | Phone on address |
    | Billing Name      | String | Name on address  |
  </Accordion>

  <Accordion title="Customer (from Order)">
    | Field               | Type   | Description           |
    | ------------------- | ------ | --------------------- |
    | Customer Email      | String | Customer's email      |
    | Customer First Name | String | Customer's first name |
    | Customer Last Name  | String | Customer's last name  |
    | Customer Phone      | String | Customer's phone      |
  </Accordion>
</AccordionGroup>

***

### Customer

Available for: **Customer created**, **Customer updated**, **Customer deleted**

| Field                     | Type   | Description                             |
| ------------------------- | ------ | --------------------------------------- |
| Email                     | String | Customer email address                  |
| First Name                | String | First name                              |
| Last Name                 | String | Last name                               |
| Phone                     | String | Phone number                            |
| Tags                      | String | Customer tags                           |
| Accepts Marketing         | String | Email marketing opt-in (`true`/`false`) |
| Lifetime Amount Spent     | Number | Total amount the customer has spent     |
| Lifetime Number of Orders | Number | Total number of orders placed           |
| Locale                    | String | Customer's locale                       |
| Product Subscriber Status | String | Subscription status                     |
| Tax Exemptions            | String | Tax exemption info                      |

***

### Returns

Available for: all **Return** trigger types (requested, approved, declined, processing, closed, cancelled, reopened, updated)

| Field               | Type   | Description                    |
| ------------------- | ------ | ------------------------------ |
| Status              | String | Current return status          |
| Return Reason       | String | Reason provided for the return |
| Line Item Count     | Number | Number of items in the return  |
| Total Refund Amount | Number | Total refund value             |
| Currency            | String | Currency code                  |
| Order ID            | String | ID of the associated order     |
| Customer Email      | String | Customer's email address       |

***

### Cart Abandoned

Available for: **Cart abandoned**

| Field           | Type   | Description                 |
| --------------- | ------ | --------------------------- |
| Customer Email  | String | Customer's email address    |
| First Name      | String | Customer's first name       |
| Last Name       | String | Customer's last name        |
| Total Price     | Number | Cart total value            |
| Currency        | String | Currency code               |
| Line Item Count | Number | Number of items in the cart |

***

## Condition Evaluation

Conditions are evaluated when a webhook is processed:

1. The worker loads the current entity data (enriched via Shopify GraphQL where needed — e.g., collections and inventory totals for products).
2. For each active trigger of the matching type, the evaluator checks every condition row.
3. Each condition's field value is looked up and compared using the specified operator.
4. Results are combined using the condition mode (`all` = AND, `any` = OR).
5. If the result is `true`, the notification is dispatched.

<Note>
  For **Product updated** and **Order updated** triggers, a notification is only sent when actual changes are detected compared to the previous snapshot. This prevents duplicate alerts from Shopify's occasional webhook re-deliveries.
</Note>
