Conditions decide whether a workflow’s actions run. They’re tested against the order data each time the workflow’s trigger fires. A workflow with no conditions runs its actions every time.
Building blocks#
There are three kinds of condition, and you can nest them as deep as you need:
| Kind | What it does |
|---|---|
| Condition | Compares one value from the order, for example order:ship_method equal to Next Day Air. |
| Group | Combines conditions with AND (all must be true) or OR (at least one must be true). A group needs at least one child. |
| List condition | Tests the elements of a list, such as the order’s items, charges, payments or shipments. Choose whether All, Any, the First, the Last, or a specific numbered element must match. A list condition needs at least one child. |
The conditions at the top level of a workflow are combined with AND: every one of them has to be true.
Operators#
Comparisons ignore case: next day air equals Next Day Air.
| Operator | Code | True when |
|---|---|---|
| Equal To | EQ |
The value equals the comparison. |
| Not Equal To | NE |
The value doesn’t equal the comparison. |
| Equal To (Comma Separated List) | IN |
The value equals any item in a comma-separated list, such as CA,NV,AZ. |
| Not Equal To (Comma Separated List) | NOT_IN |
The value equals none of the items in the list. |
| Contains | CO |
The comparison appears anywhere in the value. |
| Does Not Contain | NC |
The comparison doesn’t appear in the value. |
| Greater Than | GT |
The value is greater than the comparison. |
| Greater Than Or Equal To | GE |
The value is greater than or equal to the comparison. |
| Less Than | LT |
The value is less than the comparison. |
| Less Than Or Equal To | LE |
The value is less than or equal to the comparison. |
| Like | LIKE |
The value matches a pattern. % matches any run of characters and _ matches one character, so %-GIFT matches any code ending in -GIFT. |
| Not Like | NOTLIKE |
The value doesn’t match the pattern. |
| Empty | NULL |
The value is empty or the path doesn’t exist. |
| Not Empty | NOTNULL |
The value has something in it. |
| Yes | TRUE |
The value is 1. |
| No | FALSE |
The value is 0. An empty value is not No; use Empty for that. |
Empty, Not Empty, Yes and No don’t take a comparison value.
Numbers compare as numbers when both sides are numeric, so order:total GT 100 works as expected.
Value paths#
A path names a value in the data, with : between each level. Order values start with order:.
| Path | Value |
|---|---|
order:total |
Order total |
order:ship_method |
Shipping method name |
order:ship_state |
Ship-to state |
order:source |
Where the order came from, such as shopper |
order:customer:login |
The customer’s login |
order:items |
The list of items. Use it in a list condition or with length(). |
order:items[1]:code |
The first item’s product code. Numbers in [ ] start at 1. |
order:payments, order:charges, order:coupons, order:discounts, order:shipments, order:returns, order:notes |
Other lists on the order |
The order data is the same as an OrderList_Load_Query response with these on-demand columns: ship_method, cust_login, cust_pw_email, business_title, payment_module, customer, items, charges, coupons, discounts, payments, payment_data, notes, shipments, returns, shipping_details and every custom field. The response parameter tables on that page list the fields you can use.
Some triggers add more values next to order, such as original_status on Order Status Change. Use them without the order: prefix.
Paths inside a list condition#
Inside a list condition, paths are relative to each element of the list. To find orders with any item coded shirt, the list condition’s field is order:items and the child condition’s field is just code.
Counting with length()#
Wrap a path in length() to test its size. A list gives the number of elements and text gives the number of characters:
length(order:payments)GT0: the order has at least one payment.length(order:items)GE10: the order has 10 or more lines.
length() works in conditions only, not as the field of a list condition. The whole field has to be the length(...) expression.
Lists without length()
Pointing a plain condition at a list or object (for example order:items with Not Empty) doesn’t test it. Inside an OR group it’s always true, and everywhere else it’s always false. Use length() or a list condition instead.
Custom fields#
Order custom fields use the module code and the field code:
order:CustomField_Values:<module code>:<field code>
Fields from the Custom Fields module use customfields, for example order:CustomField_Values:customfields:gift_message.
Queue membership#
Each queue is a custom field of the Order Workflow module: order:CustomField_Values:orderworkflow:<queue code>. The value is 1 when the order is in the queue and empty when it isn’t.
- In the queue: Yes or Not Empty.
- Not in the queue: Empty. No doesn’t match, because the value is empty, not
0.
Examples#
Paid orders only (the default New & Updated Orders workflow):
| Field | Operator | Value |
|---|---|---|
length(order:payments) |
Greater Than | 0 |
Next day air orders over $200: a Group set to AND containing:
| Field | Operator | Value |
|---|---|---|
order:ship_method |
Contains | Next Day |
order:total |
Greater Than | 200 |
Orders with any gift card item: a List Condition on order:items set to Any, containing:
| Field | Operator | Value |
|---|---|---|
code |
Like | GIFT-% |
Orders not yet sent to the warehouse:
| Field | Operator | Value |
|---|---|---|
order:CustomField_Values:orderworkflow:warehouse |
Empty |
The examples page has complete workflows built from these.