Skip to main content

Shopify Customer Segments: Advanced Filtering Guide

  • November 2, 2026
  • 6 min read
  • By CYPHEX
Shopify Customer Segments: Advanced Filtering Guide

If you send the same email to every customer on your list, Shopify customer segments are the fix. This guide is for store owners and marketers who want to pick audiences properly, and for the developers who back them up. You will see which filters exist, how to write a segment by hand, and ten queries you can paste in today.

What are Shopify customer segments?

A segment is a group of customers defined by rules. Shopify re-evaluates the rules as customer data changes, so people join and leave the group without you touching it. Every segment is a ShopifyQL query. In the segment editor the FROM and SHOW parts are fixed, and you only edit the WHERE conditions, as the segment help page explains.

Search results for this topic tend to stop at “click Customers, then Segments, add a filter”. That works for a first segment. It does not tell you what the filters are called, how dates behave, or why a query returns zero people. Those are the parts below.

How do I create a customer segment in Shopify?

You have four routes, and they all end up as the same query text:

  • Build it with filter buttons in the Customers area.
  • Start from one of Shopify’s templates.
  • Copy an existing segment and edit it.
  • Write or edit the query directly. Errors are underlined in red with a message.

Sidekick, Shopify’s assistant, can also draft a query from a plain sentence such as “customers who last ordered more than 90 days ago and are subscribed to marketing emails”. Read the result before saving. The help page says the same.

One catch: if you type into the query, nothing changes until you press Run.

Segment query language: the rules that bite

The segment query language reference is short and worth reading once. The points that cause most failures:

  • Text and enum values are case-sensitive. 'SUBSCRIBED' matches, 'subscribed' does not.
  • Tag matching with CONTAINS is not case-sensitive.
  • Decimals use a full stop and there are no thousands separators: amount_spent > 999.99.
  • A query can hold 10 clauses at most.
  • Relative dates use -30d, -2w, -6m and -1y, counted in your shop’s time zone.
  • AND binds before OR. Use brackets when you mix them.
  • Maths and string functions such as SUM or LOWER are not supported.

The main attributes are number_of_orders, amount_spent, first_order_date, last_order_date, abandoned_checkout_date, customer_countries, customer_tags, email_subscription_status, sms_subscription_status, rfm_group and predicted_spend_tier. There are also functions: products_purchased, orders_placed, anniversary() and a handful of storefront and email-activity ones.

Ten segments to copy

Paste each WHERE condition into the editor and look at the match count before you save. Thresholds are examples; set them from your own order data. Country values are two-letter codes.

  1. VIP customers: number_of_orders >= 3 AND amount_spent > 500
  2. Lapsed buyers, no order in about six months: number_of_orders >= 1 AND last_order_date < -180d
  3. New customers from the last 30 days: number_of_orders = 1 AND first_order_date > -30d
  4. High spenders in one country: amount_spent > 300 AND customer_countries CONTAINS 'CA'
  5. Subscribers who never bought: email_subscription_status = 'SUBSCRIBED' AND number_of_orders = 0
  6. Recent abandoned checkouts: abandoned_checkout_date > -7d
  7. Bought from a product group in the last year: products_purchased MATCHES (tag = 'Sports wear', date >= -12m)
  8. Subscribed but never bought that group: email_subscription_status = 'SUBSCRIBED' AND products_purchased NOT MATCHES (tag = 'Sports wear')
  9. Wholesale accounts by tag: customer_tags CONTAINS 'wholesale'
  10. Birthday today, if you store a date in a customer metafield: anniversary('metafields.facts.birth_date') = today

What about “viewed a product but did not buy”? Shopify has storefront_event.product_viewed and collection_viewed, but the reference does not document their parameters. Build that one with the filter buttons and read what the editor generates. It also depends on visitors having accepted tracking, so the group will be smaller than you expect.

Not sure where to set a VIP line? The rfm_group filter (recency, frequency, monetary value) does the sorting for you, at the cost of control. Pick its values from the dropdown.

From goal to filters to action

GoalFiltersWhat you do with it
Thank your best customersnumber_of_orders, amount_spentEarly access or a handwritten-style thank-you
Win back lapsed buyerslast_order_date, number_of_ordersWin-back email, no discount on the first message
Look after new buyersfirst_order_date, number_of_ordersCare advice and a review request
Market to one countrycustomer_countries, amount_spentLocal shipping or event news
Get subscribers to orderemail_subscription_status, number_of_ordersFirst-order message
Follow up checkoutsabandoned_checkout_dateSee abandoned cart recovery
Cross-sellproducts_purchasedRefill or accessory email
Trade customerscustomer_tagsPrice list, restock news

Segments versus tags versus collections

A segment is a question you ask of your data, and the answer changes. A tag is a label that stays put until someone or something removes it. Use a tag when the fact is not in Shopify already, such as “approved wholesale” or “met at a trade show”, and a segment when Shopify can work it out. Tags can feed segments, as example 9 shows. Our piece on customer tags and lifecycle automation covers the split in detail.

Collections group products, not people. The only link is that a segment can filter on which products someone bought.

Using segments in email, SMS, Flow and the API

Pick a segment as the audience when you create a Shopify Email campaign. Marketing apps vary in whether and how often they sync segments, so check each app’s documentation before you rely on it.

In Shopify Flow there is a “customer joined segment” trigger, which can add a tag or alert your team. It acts on customers who join after the workflow is live, so existing members are not back-filled.

For developers, the Admin GraphQL segments query returns segments with their names and defining queries, and supports first, after, a search query and sorting. Check the docs for the current API version and the access scopes your app needs. If you are starting a custom app, the build guide covers the basics.

A segment is just a list of people. Whether you can contact them is a separate question. Put a marketing-state condition in every audience you intend to email or text, for example email_subscription_status = 'SUBSCRIBED'. GDPR, ePrivacy, CCPA and SMS rules differ by country, so check local law, and honour unsubscribes. Browsing-based segments rely on tracking consent as well. Keep sensitive personal details out of tags and metafields you use for targeting.

Mistakes I would check for first

  • No consent condition, so unsubscribed people get mail.
  • Wrong case in an enum value, giving zero matches with no obvious error.
  • A VIP threshold that matches five people, or half the store.
  • Overlapping segments that nobody can tell apart. Name them by purpose, like “Lapsed 180d, subscribed”.
  • Treating a segment as a record. It moves; export or tag if you need a snapshot.
  • Skipping the match count before a send.

Frequently Asked Questions

Do I need to know ShopifyQL to make a segment?

No. The filter buttons, templates and Sidekick all work without it. The query text helps when you want exact control or want to copy a segment to another store.

Can one customer be in several segments?

Yes. Segments are independent, so one person can match many of them at once.

How are segments different from tags?

Segments are calculated from data and update themselves. Tags are labels added by people, apps or workflows and stay until removed.

Can I email a segment that includes unsubscribed customers?

You should not. Add a subscription-status condition and check the rules in your region.

How many segments can I have?

The query reference lists 250 as the number of segments you can query through the API. Check that page for the current figure before planning a large set.

Conclusion

Start with three Shopify customer segments: new buyers, lapsed buyers and subscribers who never ordered, each with a consent condition. Check the match counts, name them clearly and review them every quarter. If you would like help with this, CYPHEX can plan and deliver it for you, with one project lead as your contact. Our Shopify services page lists what we cover.

Stock photography provided by Pexels under the Pexels License.

Want your online store to sell more?

We can review your store and show you what to fix first to turn more visitors into buyers.

Comments

  1. Loading comments...

Leave a comment

Selling online?

Turn more visitors into orders

A faster, clearer store with better product pages and checkout. We handle Shopify and WooCommerce from setup to growth.

Step 1 of 3

Tell us what you need

Three quick steps. We reply within one business day.

What do you need help with? Pick all that apply