Do you want to display coupons used in an order in the confirmation email? This article provides a simple but efficient guide.
Including coupon details in order confirmation emails dramatically enhances customer experience and clarifies applied discounts.
When customers see the coupons they used, it reassures them that their discount was successfully applied, reducing confusion and potential support requests.
In this guide, we’ll walk you through the steps to display coupons in order confirmation emails, making the process seamless and professional.
Why Show Coupons in the Order Confirmation Email
Including coupon details in the order confirmation email offers several benefits for businesses and customers. Here’s why it’s a great thing:
- Reduces Support Requests: Customers sometimes forget the discount they used and might contact customer support for clarification. Showing the coupon details upfront helps minimize these inquiries, saving time for both the customer and your team.
- Reinforces Promotional Campaigns: If you run seasonal or limited-time promotions, displaying coupons in emails reminds customers of your ongoing offers. This can encourage them to return and shop again.
- Enhances Customer Experience: A well-structured confirmation email with precise coupon details improves the shopping experience. It shows professionalism and keeps customers informed about their savings.
- Encourages Future Purchases: When customers see the discounts they receive, they may be more likely to take advantage of similar promotions in the future. You can also use this space to offer a new coupon for the next purchase.
Now that you understand why you should include coupons in order confirmation emails, the next section will explain how to add this feature to your email template.
How to Display Coupons Used in an Order Confirmation Email
There are two ways you can achieve it:
- With a dedicated plugin
- Using a code snippet
We will show you both methods below. You can pick one based on your preferences.
1. Plugin Method
We will be using the YayMail plugin for this task. It is one of the best tools available, and you can customize your WordPress/WooCommerce email templates without touching a single line of code.
For this tutorial, we will use the plugin’s premium version.
Before starting the configuration with YayMail, you should create a coupon for your WooCommerce store. You can do it through the marketing > coupons section.
Next, you need to go to the YayMail settings. You can see it under the MainYayCommerce settings.
Step 1. Select Right Template
Once you have opened the YayMail settings, go to the dropdown and select the right template. In this case, we will choose the completed order template.
You can now start modifying the template. You can use a sample order template or one of your existing orders.
Next, you can mention the coupon in the content.
Step 2. Copy the Shortcode
To do that, click the i button at the top. This will display every shortcode in the plugin. Find the one related to the coupon.
The shortcode is:
[yaymail_order_coupon_codes]
So, you need to insert this into the email content. Of course, you can add some text elements to improve it.
Step 3. Integrate the Shortcode in Email Content
In our case, we modified the email template like this:
That’s it!
From now on, the added block will be displayed on the confirmation email.
But what if the customer didn’t use any coupon code?
We do not need to show that specific block, right?
Thankfully, YayMail comes with a conditional logic add-on. In certain situations, you can show or hide specific blocks.
Here’s how you can configure it.
Step 4. Enable Conditional Logic
Select the block and scroll down to the YayMail settings until you see the conditional logic options. There, you need to add a new set of conditional logic.
Now, select coupon code as the rule type.
Now, select all the coupon codes you have on the website.
Once you have done that, save the changes.
From now on, the block will only be displayed when the coupon is applied at checkout. It will be hidden in the email if a customer doesn’t use a coupon.
As you can see, the YayMail plugin makes it easy to showcase the coupon code in order confirmation emails.
Instead of a plugin, if you are into coding, follow the next method.
2. Coding Method
Here’s a simple solution if you need to use coding for the task. You only need to copy the code from here and paste it on your functions.php file or the code snippets plugin.
The snippet you need to use is:
/**
* Snippet Name: WooCommerce Show Coupon Code Used In Emails
* Snippet Author: yaycommerce.com
*/
add_action( 'woocommerce_email_after_order_table', 'yaycommerce_show_coupons_used_in_emails', 10, 4 );
function yaycommerce_show_coupons_used_in_emails( $order, $sent_to_admin, $plain_text, $email ) {
if (count( $order->get_coupons() ) > 0 ) {
$html = '<div class="used-coupons">
<h2>Used coupons<h2>
<table class="td" cellspacing="0" cellpadding="6" border="1"><tr>
<th>Coupon Code</th>
<th>Coupon Amount</th>
</tr>';
foreach( $order->get_coupons() as $item ){
$coupon_code = $item->get_code();
$coupon = new WC_Coupon($coupon_code);
$discount_type = $coupon->get_discount_type();
$coupon_amount = $coupon->get_amount();
if ($discount_type == 'percent') {
$output = $coupon_amount . "%";
} else {
$output = wc_price($coupon_amount);
}
$html .= '<tr>
<td>' . strtoupper($coupon_code) . '</td>
<td>' . $output . '</td>
</tr>';
}
$html .= '</table><br></div>';
$css = '<style>
.used-coupons table {
width: 100%;
font-family: \'Helvetica Neue\', Helvetica, Roboto, Arial, sans-serif;
color: #737373;
border: 1px solid #e4e4e4;
margin-bottom:8px;
}
.used-coupons table th, table.tracking-info td {
text-align: left;
border-top-width: 4px;
color: #737373;
border: 1px solid #e4e4e4;
padding: 12px;
}
.used-coupons table td {
text-align: left;
border-top-width: 4px;
color: #737373;
border: 1px solid #e4e4e4;
padding: 12px;
}
</style>';
echo $css . $html;
}
}
Publish the snippet, and you will be good to go.
That’s it!
Once you have pasted the code correctly, the email will show the coupon code inside.
Testing the Updated Email
To test the feature, you should order something with a sample coupon code. Since WooCommerce sends follow-up emails, you will see them in the emails you receive.
Feel free to modify the content as you like.
Best Practices for Coupon Display in Emails
To ensure that coupon details are clear and compelling in order confirmation emails, follow these best practices:
- Keep It Simple and Clear: Ensure coupon details are easily read and understood. Use a simple format that clearly shows the coupon code, discount amount, and applicable conditions. Avoid cluttering the email with too much information.
- Highlight the Discount: Use bold text, different colors, or a box around the coupon details to make them stand out. This helps customers quickly spot the discount they received and reinforces the value of their purchase.
- Place Coupon Details Strategically: Position the coupon information near the order summary so customers can quickly see how much they saved. Avoid placing it too far down in the email, where it might get overlooked.
- Maintain a Consistent Design: Ensure the coupon details match the email design. A professional and visually appealing layout creates a seamless experience and enhances brand trust.
- Test Before Sending: Before finalizing your email template, test it to ensure the coupon details display correctly across different email clients and devices. Tools like YayMail let you preview and adjust your email layout for a perfect presentation.
Following these best practices will ensure that your coupon details are precise, professional, and effective in driving customer satisfaction.
Get Started with YayMail
Frequently Asked Questions
Now, let’s see some frequently asked questions related to the topic.
Displaying coupon details in the confirmation email helps customers see the discounts they received, making the transaction more transparent. It also serves as a reminder of the promotion, encouraging them to shop again.
Yes! With email customization tools like YayMail, you can easily adjust how coupon details are displayed, including font styles, placement, and additional messages to enhance the customer experience.
Double-check your email template settings if the coupon information isn’t showing up. With YayMail, you can preview and customize the email layout to ensure the coupon details are properly displayed.
Yes, the coupon can be displayed in the confirmation email, whether it offers a percentage discount, a fixed amount off, or free shipping. YayMail makes it easy to format and show the correct discount information based on the order.
Conclusion
Including coupon details in order confirmation emails is a simple yet effective way to enhance customer experience.
It provides transparency, reassures buyers about the discounts they receive, and even encourages future purchases. Instead of manually editing email templates, YayMail makes the process effortless. With its easy-to-use drag-and-drop editor, you can customize your order confirmation emails and display coupon details exactly how you want.
Whether you want to add discount codes, adjust the layout, or personalize the message, YayMail simplifies everything—no coding required!
Start using YayMail today to create professional, customized emails informing and engaging your customers.
What else would you add to the order confirmation email?
Let us know in the comments.