Mint Single-Use Shopify Discount Codes for One Product From a Product Block

The project-level Discount offer targets a whole audience with one store-wide (or one-product) code. This is the narrower, block-level sibling: a discount that lives on the Product block itself, tied to one real product you imported from your Shopify catalog, minted per recipient the moment their email sends, and redeemed straight back on that product's own page — no Purchase history segment or Discount offer setup required.

A Studio Product block linked to your Shopify store can mint its own single-use discount code per recipient, scoped to that one product — no Purchase history segment or project-level Discount offer required.

MailInApp already has a project-level Discount offer for targeting a whole matched audience with one code. This is the narrower tool: a discount that lives on the Product block itself, tied to whichever real product you imported from your Shopify catalog, minted automatically for every recipient of that email, and redeemed straight back on that product's own page.

Step 1 — Connect Shopify

From Settings → Integrations, connect your Shopify store if you haven't already. MailInApp requests write_discounts alongside its read scopes specifically so it can mint the codes this use case relies on — it never asks for write access to your products, orders or customers themselves.

Step 2 — Import the product into a Product block

In the Studio, add a Product block and open its Import from store search. Pick the real item from your synced Shopify catalog rather than typing a URL by hand. Importing does three things at once: fills in name, description, image and price; switches Checkout to Link to external store checkout; and fills in External product page URL from the product's own Shopify handle. All three matter for the next step — a hand-typed URL has no real store product id behind it, so the discount toggle stays hidden until you import.

Step 3 — Turn on Per-product discount

With a real imported product on the block, a Per-product discount toggle appears in the Inspector. Turn it on and set:

  • Discount type — percentage or fixed amount off.
  • Discount value — the actual number.
  • Expires (days after send) — how long a minted code stays valid.

This is independent of any project-level Discount offer the project might also have — a send can carry both, neither, or one without the other.

Step 4 — Send, and MailInApp mints a code scoped to just this product

Right before each recipient's email renders, MailInApp looks up their Shopify customer record by email and creates a discount code through Shopify's Admin GraphQL API: single-use (usageLimit: 1), restricted to that one customer, and restricted to just this product rather than your whole store. The block's own Buy now link is rewritten automatically to carry it — nothing to template with a merge tag by hand, since a block id isn't something you can type into a heading.

Step 5 — The shopper lands back on the exact product, code already applied

Redemption goes through your store's own /discount/<code> URL, which redirects straight to this product's own page with the code pre-applied — not your storefront's homepage and not a generic cart. That's deliberate: the email showed them one specific item, so the discounted link should land them on that same item, not make them re-find it.

Attribution works the same as any other store click

The redemption link still carries the same utm_campaign your project's other outbound links do. An order placed with the code attributes back to this send the same way any other Shopify click-through order does — see tracking Shopify orders, checkouts & revenue for how that attribution actually works end to end.

If minting fails for a recipient

Their email still sends. If no Shopify customer record matches their email, or the live API call hiccups, that recipient's Buy now just falls back to the block's plain, undiscounted product link — never a broken link, and never a blocked send.

How this differs from the project-level Discount offer

The Send page's Discount offer targets a whole matched audience — often paired with a Purchase history segment — with one code scope picked from a dropdown (store-wide or one product). This feature skips all of that: it's scoped to whatever product the block itself carries, needs no audience filter, and mints for anyone who receives the email. Each keeps its own cooldown marker too, so a per-product discount on one item never blocks another item's discount, or the project-level offer, for the same contact. See Win back past buyers with purchase-history segments & discount codes for the audience-targeted version of this pattern.

Getting started

Connect Shopify, import one real product into a Product block, turn on a modest Per-product discount, and send it to a small list first to confirm the redemption link lands where you expect. See Product block, Shopify integration, and Store-native discounts for the full reference.

A typical build-and-send sequence

  1. 1

    Connect Shopify

    From Settings → Integrations, connect your Shopify store if you haven't already. MailInApp requests write_discounts alongside its read scopes specifically so it can mint the codes this use case relies on.

  2. 2

    Import the product into a Product block

    In the Studio, add a Product block and use its Import from store search to pick the real item from your synced Shopify catalog. Importing sets Checkout to Link to external store checkout and fills in External product page URL automatically — both required for the next step to appear.

  3. 3

    Turn on Per-product discount

    Once the block carries a real imported product, a Per-product discount toggle appears in the Inspector. Turn it on and set a percentage or fixed amount off and how many days a minted code stays valid — independent of any project-level Discount offer this project might also have.

  4. 4

    Send — MailInApp mints a code scoped to just this product

    Right before each recipient's email renders, MailInApp looks up their Shopify customer record by email and creates a single-use discount code through Shopify's Admin GraphQL API, restricted to that one customer and to just this product — not your whole store.

  5. 5

    Buy now already carries the code

    The block's Buy now link is rewritten to your store's /discount/<code> redemption URL, which redirects the shopper straight back to this product's own page with the code pre-applied — not your storefront's homepage or generic cart.

  6. 6

    Attribution works the same as any other store click

    The redemption link still carries the same utm_campaign your project's other outbound links do, so an order placed with the code attributes back to this send the way any other Shopify click-through does.

Frequently asked questions

How is this different from the project-level Discount offer?

The Discount offer on the Send page targets a whole matched audience — often paired with a Purchase history segment — with one code scope for everyone (store-wide or one product, picked from a dropdown). A Product block's own Per-product discount is scoped to that block's one imported item and needs no audience filter or Send-page setup at all; it mints automatically for anyone who receives that email. A project can use either, both, or neither — they run independently with separate cooldowns.

Do I need a Purchase history segment for this to work?

No. Purchase history segmentation pairs with the project-level Discount offer, not this one. A Product block's per-product discount mints for every recipient of the email it's in, regardless of whether they've bought that item — or anything — before.

What if a recipient has no Shopify customer record yet?

Minting looks up the recipient by email against your Shopify customers. If none matches, that recipient's code fails to mint and their email still sends — with the plain, undiscounted product link Buy now would otherwise use, never a broken one.

Why does the discount toggle not show up on my Product block?

It only appears once the block carries a real product imported through Import from store — minting needs your store's own numeric product id to restrict the code to, which a hand-typed External product page URL doesn't carry. It's also hidden entirely in MailInApp checkout mode, since that mode never touches your Shopify store at all.

Can I run this on more than one product in the same email?

Yes — each Product block mints and tracks its own code and cooldown independently, keyed to that block, so discounting one product never blocks or interferes with a discount on a different one, or with the project-level Discount offer.

Does the coupon URL still work if the recipient forwards the email?

The code itself stays single-use and restricted to the original recipient's own Shopify customer record, so a forwarded email doesn't hand a stranger a usable discount — only that original shopper can actually redeem it at checkout.

Build this in the studio

Start on the free plan — every interactive block and the full fallback engine are included on every tier.