Sending discount codes in your emails
You can now include the discount a visitor received from a popup directly in a Popup-connected email using a merge tag.
What it's for
A lot of popups generate a discount code for the visitor, either a fixed code from a standard coupon popup, or a code tied to whatever prize they land on in a spin-to-win wheel popup. Until now, that code only showed up inside the popup itself. If a visitor closed the popup before copying it, or just wanted it in their inbox, there was no easy way to follow up with the right code automatically.
The {{ discount_code }} merge tag solves that. Drop it into any Popup-connected email, and it's replaced with that specific visitor's code when the email sends.
The merge tag
{{ discount_code }}
Wherever you place this in your email content, it's swapped out for the real discount code belonging to the visitor who triggered the email.
Where it pulls the code from:
- Regular coupon popups - the fixed discount code set up on that campaign.
- Spin-to-win (wheel) popups - the specific code tied to the prize the visitor landed on, not just any code from the wheel.
Either way, you don't need to know in advance which code a visitor will get. The merge tag always resolves to the right one for that person.
Adding it to an email
- Go to the Conversion tab of your popup campaign and open Send an Email.
- Select an existing email or create a new one.
- In the email editor, place your cursor where you want the code to appear.
- Insert the merge tag:
{{ discount_code }} - Save and send yourself a test email to confirm it resolves correctly.

Tips
- Make the code stand out. Bold it, put it on its own line, or box it visually, so it isn't lost in paragraph text.
- Don't hardcode a fallback code. If you type a specific code next to the merge tag "just in case", you risk sending two different codes in the same email, which confuses customers. Trust the tag.
Common questions
- What happens if the popup doesn't generate a code at all, like an announcement popup?
- The merge tag has nothing to pull in that case, so avoid adding it to emails connected to campaigns that don't issue a code.
- Will this work for a campaign I've already published?
- Yes. You can add the merge tag to any existing Popup-connected email; it applies going forward to new emails sent from that campaign.
- Does the code expire based on when the email is sent, or when the popup was shown?
- The code itself follows whatever expiration rules you've set on the discount in Shopify. The merge tag only inserts the code, it doesn't change its expiration.
- Can I use this merge tag outside of Popup-connected emails?
- No, it's only available in emails tied to a popup campaign, since that's where the code comes from.
Updated on: 02/10/2026
Thank you!