Customer segments

Segment customers who bought a product

Use the products_purchased filter. It takes product IDs, a product tag, a date, and quantities, written with the 2026-10 MATCHES syntax.

Build or convert a segment

Pick filters in plain English and copy a query Shopify accepts, or paste an old query to convert it.

Runs in your browser. Nothing is sent anywhere.

Open the Segment Builder

Bought a specific product

Bought this product, any time
products_purchased MATCHES (id = 1012132033639)

The ID is the number at the end of the product’s URL in your admin. In the segment editor you can also pick the product by name and Shopify fills in the ID.

Bought any of several products

Up to 500 IDs in one list
products_purchased MATCHES (id IN (1012132033639, 2012162031638))

Bought one product but not another

Cross-sell audience
products_purchased MATCHES (id = 1012132033639) AND products_purchased NOT MATCHES (id = 2012162031638)

By product tag and date

Bought anything tagged Sports wear in the last 12 months
products_purchased MATCHES (tag = 'Sports wear', date >= -12m)
Bought 3 or more tagged items in 90 days
products_purchased MATCHES (tag = 'product_tag', sum_quantity >= 3, date >= -90d)

quantity is the quantity in one order; sum_quantity is the total across all orders. Leaving out date means all time.

Build it without typing

The Segment Query Builder has a Products purchased filter with fields for IDs, tag, dates and quantities, and writes the query for you.

Sources: Shopify Help Center: Shopify-based customer segment filters; shopify.dev: Segment query language reference. Not affiliated with, endorsed by, or sponsored by Shopify Inc. Shopify is a trademark of Shopify Inc.