"People who bought X between date A and B" isn't a lifetime-spend rollup — it's real order line items. Once a Shopify or WooCommerce store is connected, MailInApp can filter on exactly that, and hand each match a real, single-use discount code redeemed on your own store.
Most win-back emails either go to everyone who hasn't bought recently, or to nobody, because building "bought this specific product in this specific window" by hand means exporting orders into a spreadsheet first. This walks through doing it inside MailInApp instead — segment, discount, send.
Step 1 — Connect your store and backfill order history
From Settings → Integrations, connect Shopify or WooCommerce if you haven't already. Either one syncs customers into a contacts list and keeps line-item order data current from then on through its own webhooks. An older connection, or a store with years of history, needs a one-time Backfill order history pull from the same Integrations panel first — ongoing orders sync automatically after that. Shopify backfills reach roughly the last 60 days unless Shopify has separately approved the app for full order history on your store; WooCommerce has no such cap.
Step 2 — Build a Purchase history audience filter
On a project's Send page, open the Audience filter and add a condition under the new Purchase history group — distinct from the plain "purchased" and "total revenue" conditions, which only look at a lifetime rollup. Pick a product (or leave it open to match any), a date range, whether to sum by amount or quantity, and the threshold:
- Bought 2+ units of a specific product in the last 90 days.
- Spent over $50 storewide between two specific dates — a seasonal win-back list.
Combine it with ordinary field conditions using the same AND/OR groups you already use for a block's visibility rules in the studio.
Step 3 — Turn on a discount offer
The same project's Discount offer section is where the actual incentive lives. Turn it on, pick a percentage or fixed amount off, how many days a minted code stays valid, and — optionally — scope it to one product instead of the whole store. Set Don't re-offer within N days too if more than one campaign might target this list, so a contact who already got a code from an unrelated send recently doesn't get a second one right away.
Step 4 — Write the email once
Drop {{discount_code}} into a heading and {{discount_url}} into a Button block's link — both are built-in merge tags, resolved per recipient the same way {{first_name}} is. Nothing about the email needs a per-person template; every recipient's copy just carries their own real values once it sends.
Step 5 — Send, and let redemption happen on your own store
Right before each matched recipient's email renders, MailInApp mints a real discount code on your connected store (a Shopify discount code or a WooCommerce coupon), restricted to that one customer's email and usable exactly once. {{discount_url}} links straight to checkout with it already applied, so there's nothing to copy-paste. If minting fails for a particular recipient — a token needs reconnecting, a live API hiccup — that recipient's email still sends anyway, just without a code that time; it's never a blocked send.
Why redemption happens on your own store
This is deliberate, not a limitation. The audience you're targeting is already shopping on your store, so the discount reuses that store's existing inventory, tax, and pricing rules instead of standing up a second point of sale for products that already have one. MailInApp's own Product block + Stripe checkout solves a different problem — selling something with no storefront behind it at all.
Reading the results
A redeemed order attributes back to the campaign that sent the code exactly the way any other store click already does — see tracking Shopify orders, checkouts & revenue for how that attribution actually works end to end.
Getting started
Connect your store, backfill order history if it's an older connection, build one Purchase history segment against a product you actually want to move, and turn on a modest discount offer before sending to that small matched list first. See Behavioral segments, Sending to your contacts, and Data sources & merge tags for the full reference.