Conditions and filters for automations
How the Filter block works, combining conditions with And and Or and one group of conditions, 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
- In the Filter block, click Add condition.
- Pick a Field (the list is grouped, for example Order, Totals and payment, Shipping, Customer, Cart or Refund, and has a search box).
- 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). To mix both, such as (VIP or 2+ orders) and shipping to Israel, add a condition, then click Add a group and fill the group. The group has its own And / Or. A group cannot contain another group, and groups are offered on order and customer events, not on product events.
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.
Example for a failed payment: Payment failed, wait 1 hour, Check after the wait: Cart status (now) is not Became an order. A shopper whose second try worked reads Became an order, so they are not sent a "payment failed" follow-up. Keep this check whenever you wait after Payment failed.
Example for a tracking number: A tracking number is added to an order, wait 1 day, Check after the wait: Order status (now) is Shipped. A label bought today writes the tracking number before the parcel ships, so the check tells an order that really shipped from one that is still waiting. This is how to act on the shipped moment from this trigger; Order fulfilled needs no check.
Example for a payment dispute: Payment dispute opened, Filter: Dispute amount is greater than or equal to 100 and Dispute currency is USD. The amount is in the dispute's own currency, so keep the currency rule next to it. A dispute has no status to filter on, because it is always open when the automation starts.
Example for a failure alert: An automation run fails, Filter: How the run ended is Failed and The retries ran out is Yes. Only a run that failed for good starts it; a run that was skipped never does. There is no Check after the wait under this trigger, because there is no Wait.
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.
- A tracking number is for printing, not for rules. Under A tracking number is added to an order the filter offers the order fields and Carrier of the tracking number. The tracking number itself is available in a notice, a team email or an HTTP call, and never in a filter, because a parcel number can identify the recipient at the carrier.
- A hold has a state and a status before, and no reason. Under An order is put on hold or released from hold the filter offers the order fields, Put on hold or released (Put on hold or Released from hold) and Status before the change. Order status there is the status after the change. Brainerce keeps no reason or note for a hold, so none can be tested.
- A dispute reason code is the provider's own code, and it differs by provider. Under Payment dispute opened the filter offers the order fields, Dispute amount, Dispute currency, Payment provider that reported the dispute and Dispute reason code. Stripe's codes are lower case (for example
fraudulent) and PayPal's are upper case (for exampleMERCHANDISE_OR_SERVICE_NOT_RECEIVED), so a rule on the reason must list the codes of each provider. The amount is in the dispute's own currency. There is no dispute status, and the evidence deadline is not a field. - A failed automation has no order or customer. Under An automation run fails the filter reads only the automation and how its run ended: which automation, How the run ended, Error code, The retries ran out, what started the run and which action failed.
- Some triggers can read only their own details, and cannot look up the customer or the order. Under A product is deleted, A stock transfer is shipped or received, A gift card is issued or reissued, An inquiry is received, A purchase order is sent to the supplier or received and A subscription, standing order or monthly donation charge is paid, declined or needs the customer the filter offers only the details of that event (for a deleted product: name, SKU, type, status before deletion and how it was deleted; for an inquiry: where it came from, form, sales channel, language and whether a signed-in customer sent it; for a recurring charge: Charge outcome, attempt, amount, currency, decline code, whether it will be retried and the status of the schedule, never the customer or the order). There is no live lookup, no Wait and no Check after the wait. The gift card code, the sender of an inquiry and the message, and the bank message of a declined charge, are never details. Each trigger's details are listed in What can start an automation.
- 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.
Orders that contain a product from a category
To act only on orders that include a product from a certain category, add a condition in an order automation (for example An order is paid): in Field choose Categories in the order, in Comparison choose Includes any of, and pick one or more categories. Use Includes none of for orders that contain nothing from them.
Good to know
- A category matches only the products that are directly in it. A product that sits only in the category Sandals does not match a rule on its parent Shoes. Pick the sub-categories too, or pick both.
- It reads the order as it was at the moment of the event. If you move a product to another category later, orders already placed are not re-read.
- Only the first 250 products or categories of an order are looked at. An order with more than that can miss a match, so do not rely on this rule for very large orders.
- A line with no product has no category. An order line that came from an import, or a custom line, matches no category.
- There is no rule on a single line. You cannot ask for "an item in this category with a quantity of 3 or more", and a condition cannot test one line. The condition only says whether the order contains such a product at all. To act on each product or line of an order, use Loop in the Then block (see Repeat for each product or line of an order); you cannot put a condition step inside a loop, but the loop has its own Only if the item meets a condition card, which can look at the line's quantity and price (see Run the loop only for some products or lines).
- The same field works in the filter, in a condition inside the steps and in a Check after the wait. See Add a condition.
The filter is also a safety rule
Ten actions are refused unless something tests the event first: Cancel the order, Fulfillment hold, Archive the order, Mark the order as shipped, Mark the order as paid, Cancel the return, Sales channel publishing, Clear a custom field, Change the stock count and Draft a purchase order. Mark the order as shipped cannot be undone, so the test matters most there: it ships only paid orders, and your filter decides which ones. 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.
What can start an automation (triggers)
Every event that can start an automation, in plain words, with what each one means, what it does not count and when it fires. Orders, orders put on hold or released from hold, tracking numbers and shipping labels, returns, customers, products, stock, reviews, abandoned carts, failed payments, payment disputes (chargebacks), stock transfers between warehouses, deleted products, gift cards issued, inquiries from the contact form or chat, purchase orders sent to a supplier or received, recurring charges of a subscription, standing order or monthly donation that are paid, declined or need the customer, failed automations and schedules.
What an automation can do (actions)
Every action in the Then block, what each one changes, what it never does (no refunds, no deleting, no discount codes in order emails), which need a condition, and how to wait, loop and call another system.