Conditions Reference
2 min read
Conditions are the filters that determine whether a rule’s actions fire. Each condition is a comparison against a field — typically a customer attribute or an order property. Conditions combine with AND logic; all must be true for the rule to act. This page lists all 22 condition fields available (16 customer-level and 6 order-only), the comparison operators they support, and example expressions.
The 6 order-only fields can only be used with an order-bearing trigger (order_placed, order_completed, refund_processed, or dispute_recorded), because those are the only triggers that carry an order context.
Anatomy of a Condition #
A condition has three parts:
- Field — what to compare. E.g.
trust_score,order_total,segment - Operator — how to compare. One of
<,<=,=,!=,>=,> - Value — what to compare against. E.g.
30,"vip","US"
Example: trust_score < 30 — true when the customer’s score is below 30.
Customer Fields #
These 16 fields are available with every trigger.
| Field | Type | Operators |
|---|---|---|
trust_score |
integer 0–100 | <, <=, =, !=, >=, > |
segment |
enum (vip / trusted / normal / caution / risk / critical) | =, != |
return_rate |
decimal 0–100 | <, <=, =, !=, >=, > |
customer_type |
enum (new / returning) | =, != |
total_orders |
integer | <, <=, =, !=, >=, > |
total_order_value |
decimal | <, <=, =, !=, >=, > |
cancelled_orders |
integer | <, <=, =, !=, >=, > |
total_refunds |
integer | <, <=, =, !=, >=, > |
total_refund_value |
decimal | <, <=, =, !=, >=, > |
coupon_then_refund |
integer | <, <=, =, !=, >=, > |
total_disputes |
integer | <, <=, =, !=, >=, > |
linked_accounts |
integer | <, <=, =, !=, >=, > |
is_first_order |
boolean (true only when total_orders equals exactly 1) |
=, != |
is_blocked |
boolean | =, != |
customer_age_days |
integer | <, <=, =, !=, >=, > |
days_since_last_order |
integer | <, <=, =, !=, >=, > |
Order Fields #
These 6 order-only fields require an order-bearing trigger (order_placed, order_completed, refund_processed, or dispute_recorded). They aren’t available with customer- or detection-level triggers, which carry no order context.
| Field | Type | Operators |
|---|---|---|
order_total |
decimal | <, <=, =, !=, >=, > |
coupon_total |
decimal | <, <=, =, !=, >=, > |
payment_method |
string (stripe / paypal / etc.) | =, != |
shipping_country |
string (ISO-2) | =, != |
billing_country |
string (ISO-2) | =, != |
country_mismatch |
boolean | =, != |
Operators in Detail #
Comparison Operators #
<, <=, =, !=, >=, > — the full operator set. == is accepted as an alias for =, and <> as an alias for !=. They work on numeric and string fields.
Enum and String Fields #
Enum and string fields (such as segment, customer_type, payment_method, and the country fields) use = and !=. To match several values, create one rule per value with the same actions.
Boolean #
Use = or !=. Example: is_blocked = false.
Multi-Condition Logic #
Conditions combine with AND only — all must be true for the rule to act. There’s no OR or grouped boolean logic at the rule level.
To express OR logic, create multiple rules with the same actions. Example: “block if score < 30 OR if disputes ≥ 2” becomes two rules, each with one condition, both with the same Block action.
Example Condition Sets #
| Intent | Conditions |
|---|---|
| “Critical customer placing high-value order” | segment = critical AND order_total > 500 |
| “Risk customer using international shipping” | segment = risk AND country_mismatch = true |
| “Customer at dispute threshold” | total_disputes >= 2 |
| “New customer with coupon-then-refund abuse” | is_first_order = true AND coupon_then_refund >= 2 |
| “Customer linked to several other accounts” | linked_accounts >= 3 |
| “VIP placing a large order” | segment = vip AND order_total > 1000 |
The Save-Time Validator and Conditions #
When you save a rule with conditions, the validator checks:
- Each field is valid for the rule’s trigger context
- Each operator is valid for the field’s type
- The combined conditions are satisfiable (no contradictions like
trust_score > 80 AND trust_score < 20) - The rule has at least one condition (or is explicitly marked “no conditions — fire on every trigger event”)
Invalid rules fail to save with a specific error message.
Performance #
Conditions evaluate against in-memory data — the trigger context plus the customer record (already fetched for the trigger event). Each condition is sub-millisecond. Even rules with 10+ conditions evaluate in under 10ms.
The engine is bound by trigger volume, not condition complexity.
Updated on June 18, 2026