> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.pop-convert.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# 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
1. Go to the Conversion tab of your popup campaign and open Send an Email.
2. Select an existing email or create a new one.
3. In the email editor, place your cursor where you want the code to appear.
4. Insert the merge tag: `{{ discount_code }}`
5. Save and send yourself a test email to confirm it resolves correctly.
![Pop Convert - Sending discount codes via email](https://storage.crisp.chat/users/helpdesk/website/-/7/0/c/e/70cef36dbfb4ac00/image_jee0lw.png =564xauto)
---
### 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.
### &#xA;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.