Conditions and filters for automations

How the Filter block works, combining conditions with And and Or, the Otherwise branch, Check after the wait and the (now) fields, and what a filter cannot see.

The Filter block decides which orders, products, customers or carts an automation acts on. Its hint reads With no filter, it always runs: every event of the trigger runs the actions. For any automation that tags, emails, changes or cancels, you almost always want a filter.

Add a condition

  1. In the Filter block, click Add condition.
  2. Pick a Field (the list is grouped, for example Order, Totals and payment, Shipping, Customer, Cart or Refund, and has a search box).
  3. Pick a Comparison, then a Value.

Comparisons depend on the kind of field: Equals, Does not equal, Greater than, Greater than or equal to, Less than, Less than or equal to, Contains, Starts with, Has a value, Is empty, Includes any of, Includes none of, Is one of and Is none of. Two are for numbers that change over time:

  • Dropped below: the value was at or above the number and is now below it.
  • Rose above: the value was at or below the number and is now above it.

These fire once when the value passes the number, not on every change. "Stock of this variant Dropped below 5" tells you once when stock goes from 5 to 4, not again at 3, 2 and 1. A plain "less than 5" would fire on every sale below 5. Use Dropped below 1 for "sold out" and Rose above 0 for "back in stock". They exist on product triggers (price and stock).

Combine conditions with And and Or

With more than one condition, How conditions combine lets you choose And (all must be met) or Or (any one is enough). You cannot mix both in one filter. For a mix, split the work into two automations.

Otherwise

Under the actions, Otherwise ("What to do otherwise") holds actions that run when the conditions are not met. Leave it empty if you only care about the matching case. Orders that do not match simply end as Skipped with "The condition was not met", which is normal.

Check after the wait

Facts are frozen at the moment the event happened. If you Wait three days and the order was unpaid when it was created, the automation still "knows" it was unpaid. To test the situation as it is now, add a Check after the wait step and use a field marked (now), such as Payment status (now), Order status (now) or Cart status (now). Waits and this check exist in order, customer and cart automations.

Example: Cart abandoned, wait 2 hours, Check after the wait: Cart status (now) is Abandoned. A shopper who came back reads Active (the shopper is back) and one who bought reads Became an order, so the automation stops there.

What a filter can read

A filter can test most fields of the event and many "live" ones read when the automation runs: order total, payment status, tags, how many days since an order was placed or shipped, the shipping country, the payment method, a customer's number of orders and total spent, their marketing status and loyalty balance, a product's stock, price, weight, rating and age, a cart's total and how long it has been idle, and the order and checkout fields you created.

Good to know

  • A field with no value never matches. If a customer has no phone, every condition on the phone is false, including "Does not equal".
  • Live values are for deciding only. A postcode, an email domain or an order note can decide a branch, but it is never printed in a notice, an email or an HTTP call, and never stored in the history.
  • A customer's total spent adds up every currency. A store that sells in several currencies should not compare it to one amount.
  • A guest has no customer. Any condition on the customer of a guest order or guest cart is false.
  • Order notes are not shown in messages. You can test whether an order note contains a word, but automations never print it.
  • Review text is not available. For a review you can test the rating, verified purchase, photo and guest, nothing about what was written.
  • There is no condition on the SEO score.
  • A new product's price, stock and custom fields are read a few seconds after it is created, and a custom field saved later than that reads as empty. To act on a custom field, use A field changed.

The filter is also a safety rule

Five actions are refused unless something tests the event first: Cancel the order, Fulfillment hold, Archive the order, Change the stock count and Draft a purchase order. A filter rule, a condition around the action, or a Check after the wait all count. The rule only checks that a test exists, not that it is a good one. See What an automation can do.