"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 — Drop in an E-Commerce Discount block
In the studio, the block palette offers an E-Commerce Discount block once your store is connected — that's where the actual incentive lives. Drop it into the email, pick a percentage or fixed amount off, how many days a minted code stays valid, how many days to wait before offering the same contact another one, and — optionally — scope it to one product instead of the whole store. The block already comes styled as a card with a headline, the code itself, and a "Shop now" button, so there's no separate step to write the email around it; turn on Show expiry countdown if you want a live countdown image in the same card.
Step 4 — 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, and fills it straight into the block's own code display and button link — nothing to copy-paste, and nothing to template per person by hand. If minting fails for a particular recipient — a token needs reconnecting, a live API hiccup — that recipient's email still sends anyway, just with the block's plain fallback label instead of a real code; 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 can link straight to your store's checkout too, via its Checkout field's Link to external store checkout option. Reach for that if you'd rather have a Buy now button next to a specific product than the discount card's own link. Its Stripe checkout mode solves a different problem instead: 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 drop in a modest E-Commerce Discount block before sending to that small matched list first. See Behavioral segments, Sending to your contacts, and Data sources & merge tags for the full reference.