Segment Query Selector
The Customer segment query tab of the Recipients Selector lets you target customers with Shopify's segment query language — the same language that powers Customers → Segments in your Shopify admin — without first saving a segment. The query is stored with the operation and resolved when it runs, so the audience always reflects your latest customer data.
How to Use the Segment Query Field
Switch to the Customer segment query tab in the Recipients section.
Type your query (or click one of the Examples buttons to start from a template).
The app validates the query as you type and shows how many customers match right now. Syntax errors are shown with Shopify's own message (e.g.
'nope' filter cannot be found).Save. The query is stored with the operation; the actual recipient list is computed when it executes.
Query Structure
A query is one or more conditions joined with AND, OR and NOT, with parentheses for grouping:
customer_tags CONTAINS 'vip' AND amount_spent >= 500(customer_tags CONTAINS 'gold' OR customer_tags CONTAINS 'platinum') AND NOT customer_tags CONTAINS 'exclude'Operators: =, !=, >, >=, <, <=, CONTAINS, NOT CONTAINS, STARTS_WITH, ENDS_WITH, BETWEEN … AND …, IS NULL, IS NOT NULL. Text values are wrapped in single quotes; numbers and dates are not quoted.
Common Use Cases & Examples
Tags
Customers with a tag:
Any of several tags:
Spend & Orders
Spent 500 or more (lifetime):
Repeat customers:
Big spenders who haven't ordered lately:
Dates (relative and absolute)
Relative dates count back from today in your shop's timezone and are written without quotes: -7d, -30d, -6m, -1y. You can also use today, yesterday and absolute dates such as 2026-01-31.
Ordered in the last 30 days:
New customers (added in the last 7 days):
Signed up in a date range:
Birthdays & Anniversaries (metafields)
Segment queries can match customer metafields — as long as a metafield definition exists for them (Settings → Custom data → Customers). Store the birthday as a date metafield (for example facts.birth_date) and use the anniversary function:
Combine with a scheduled daily campaign to send a gift card on every customer's birthday. Note that function parameters are named — anniversary(date: '…') works, anniversary('…') does not.
Metafield value checks:
Marketing Consent
Recommended for any campaign that sends email:
Location
Products Purchased
Store Credit
Target customers by their store credit balance (great for Store Credit Bulk Add top-ups or reminder-style campaigns):
Each MATCHES (...) clause may contain one field — use several clauses joined with AND for multiple conditions.
Liquid Templating
Like the Customers query tab, the segment query is rendered with Liquid before it runs, so {{ "now" | date: "%Y-%m-%d" }} works. In practice you rarely need it: the segment language has built-in relative dates (today, -30d) that resolve in your shop's timezone, whereas Liquid's "now" uses the server clock. Prefer the built-in forms.
Limits
Operations resolving more than 3000 customers are paused (bulk operations) or paused with an error (campaigns) to prevent accidental mass sending. The count preview warns you before you save.
Customers without an email address are skipped for email-based operations.
The preview count reflects today's data; scheduled runs use the data at execution time.
Troubleshooting
"… filter cannot be found" / syntax error
Check the field name against Shopify's segment filter reference.
Text values need single quotes; dates and numbers must be unquoted.
Functions need named parameters:
anniversary(date: '…').
Metafield query is rejected
A metafield definition must exist for the customer metafield (date, number, text or boolean types) before it can be queried.
"Found 0 customers"
Verify the tag / value spelling — matches are exact.
Relative dates only look backwards (
-30d); future dates must be written as absolute dates.
Query works in Shopify admin but not here
Copy the query from Shopify's segment editor exactly — the app runs the same engine. Contact support@code57.pl with the query and we'll help.
Related
Recipients Selector — all five ways to choose recipients.
Customers Query Selector — the search-syntax alternative with Liquid date examples.
Shopify: Customer segments reference.
Last updated