Store-Native Discount Code Minting
MailInApp supports dynamic Store-Native Discount Code Minting for connected Shopify and WooCommerce stores.
Rather than forcing buyers through a third-party checkout or generic public coupons, MailInApp automatically mints single-use, customer-restricted discount codes directly on your store at send time — through either of two independent mechanisms, which a single project can use together, separately, or not at all:
- Project-level Discount offer — a Send-page setting that mints one code per matched recipient, scoped to your whole store or to one product picked from a dropdown, meant to pair with a Purchase history audience segment. See Discount offer.
- Per-product Product block discount — a toggle on the Studio Product block itself, scoped to exactly whichever item that block imported from your catalog, needing no audience filter or Send-page setup at all. Walked through end to end in Shopify product discount codes and WooCommerce product discount codes.
Both mint through the same underlying store connection and share the mechanics below; a per-product discount just additionally restricts the code to one item and keeps its own cooldown marker, separate from the project-level offer's and from every other Product block's.
How It Works
When a campaign or journey includes a discount offer:
- Dynamic Customer Resolution:
- Shopify: Resolves the recipient's customer GraphQL ID (
gid://shopify/Customer/...) via Admin GraphQL before generating the discount node. - WooCommerce: Restricts the generated coupon to the recipient's exact email address using WooCommerce REST API.
- Shopify: Resolves the recipient's customer GraphQL ID (
- Single-Use & Secure:
- Codes carry random cryptographic suffixes (e.g.
MIA-7F3A91B2). - Every code is restricted to a single use (
usage_limit: 1) and tied exclusively to the recipient's email address, preventing coupon leakage on deal sites.
- Codes carry random cryptographic suffixes (e.g.
- Optional Product Scoping:
- A code minted store-wide applies to any purchase. One scoped to a product — the project-level offer's own Scope picker, or a Product block's per-product discount — is restricted to just that item: Shopify via
customerGets.items.products.productsToAddon a real Product GID, WooCommerce via the coupon'sproduct_idsfield.
- A code minted store-wide applies to any purchase. One scoped to a product — the project-level offer's own Scope picker, or a Product block's per-product discount — is restricted to just that item: Shopify via
- Store Checkout Pre-Application:
- A store-wide or project-scoped code's link applies it at your generic checkout (
/cart/?coupon=MIA-...for WooCommerce,/discount/MIA-...redirecting to/for Shopify). - A Product block's own per-product discount instead lands the shopper straight back on that product's own page with the code already applied (
?coupon=MIA-...appended to the product URL for WooCommerce;/discount/MIA-...?redirect=<product path>for Shopify) — not the storefront root, since the email pointed them at one specific item.
- A store-wide or project-scoped code's link applies it at your generic checkout (
- Visible Before the Shopper Clicks Through:
- The Studio canvas shows the same discount badge and struck-through price as the mailed email and Live view the moment you turn on a Product block's per-product discount — no need to open Live view to check it.
- For Shopify stores, an optional MailInApp discount badge app block shows that same badge directly on the live product page for a shopper who clicked through from the email, ahead of checkout — see Showing the discount on your product page (Shopify) below for setup. There's no WooCommerce equivalent — WooCommerce coupons have no mechanism for changing what a product page itself displays.
Showing the discount on your product page (Shopify)
The Studio canvas already shows the discount badge and struck-through price the moment you turn on a Product block's per-product discount — no setup needed. Putting that same badge on your live Shopify storefront is a one-time, manual step per store, since MailInApp never edits your theme automatically:
- In Shopify Admin, go to Online Store → Themes and click Customize on your live (or a draft) theme.
- Switch the page picker at the top to a Product page.
- Click into the section that shows the price/buy button — usually Product information or Buy buttons.
- Click Add block inside that section (not "Add section") and choose MailInApp discount badge under Apps.
- Drag it next to the price, optionally adjust its badge colors in the settings panel, then Save.
If Apps doesn't appear in that section's block picker, that section hasn't opted into app blocks yet — try a different section, or ask your theme developer to add {"type": "@app"} to its schema. Most Online Store 2.0 themes (Dawn and its forks) already support this in the main product section. Requires an Online Store 2.0 theme.
The badge stays invisible on an ordinary storefront visit by design — it only renders when the product page loads with the signed link a real per-product-discount email produces. So browsing to the page yourself won't show it, and neither will Send test (that renders the email directly and skips the discount-minting step that signs the badge's link). To actually see it, send for real to a recipient — even just yourself — and click Buy now from the delivered email. It's a display-only preview computed from the product's own price; the real discount still only ever applies at checkout via the single-use code either way.
Supported Offer Types
- Percentage Off: e.g., 15% or 20% sitewide, collection, or single-product discount.
- Fixed Amount Off: e.g., $10 or $25 off total cart value, or off one product.
- Expiry Windows: Codes carry an auto-computed expiration date (e.g., 7 or 14 days from send time) so urgency is enforced on the merchant's store.
- Account Cooldowns: Built-in cooldown markers prevent over-couponing the same contact across multiple schedules or projects — one marker for the project-level offer, and a separate one per Product block, so discounting one product never blocks another's cooldown or the project-level offer's.
Setup & API Integration
- Shopify: Requires connected store credentials with
write_discountsscope (handled during OAuth connection). - WooCommerce: Requires connected store REST API consumer key and secret with read/write permissions.
A Product block's per-product discount additionally requires that block to have a real product imported via its Import from store picker (not a hand-typed external URL) — minting needs your store's own numeric product id to restrict the code to.