Display discount codes in new order notification email

Topic summary

  • Goal: show discount codes in the new order notification email. The initial loop over discounts displayed the savings amount but left the code blank, even for admin-created orders.

  • Resolved for the OP by iterating discount_applications and using Liquid (Shopify’s template language):

    • title via discount_application.title
    • amount via discount_application.total_allocated_amount
      This showed the discount title and the allocated savings.
  • Product update: a Shopify orders PM noted planned improvements to the notification email and requested feedback on how merchants use it and desired changes. No release timeline or specifics were given.

  • Related need: adding a customer PO number captured as a cart attribute to the email. Guidance provided to output it with Liquid variables in the template:

    • {{ order.attributes[“your-attribute-name”] }} or {{ attributes.your-attribute-name }}
  • New issue: another user reports discount_application.title returns a generic “Discount” instead of the specific code (e.g., PURE_SHIPPING), with value showing as 5.0. No solution was offered yet.

  • Status: Partially resolved. The OP’s issue and PO attribute inclusion have clear approaches; the generic title problem remains open.

Summarized with AI on February 6. AI used: gpt-5.

I want to display discount codes in new order email notification template, using this code:

{% for discount in discounts %}
      {{ discount.code }} : {{ discount.savings | money_with_currency }}
{% endfor %}

It’s displaying the discount amount but not the discount code name/title. It’s returning blank even if the discount is manually entered in the back-end when creating an order.

How can I display discount codes no matter where it’s entered i.e in admin or checkout?

Was able to solve it with the below code:

{% for discount_application in discount_applications %}
	{{ discount_application.title }} : -{{ discount_application.total_allocated_amount | money_with_currency }}
{% endfor %}

Hi,

My name’s Jordan and I’m a product manager on the orders team here at Shopify. I hope you don’t mind me following up here, but I wanted to share with you that we’re planning on making some improvements to that email notification. There’s no denying it’s outdated and could use a design uplift, but I’m curious how you find it useful? Do you use for it anything specific outside of just being notified of a new order? Is there anything you’d like to see changed with it?

If you’re not too busy to reply, it’d be great to connect and hear your feedback so I can share it with the team. Feel free to message me directly!

All the best,

Jordan

Hi Jordan

I am new to Shopify and we use the notifications to process the orders on behalf of one of our clients.

I am currently after some help in adding a customer PO number to the new order email notification for invoicing purposes would you be able to assist me with code required to do this. We capture a customer PO when they place an order but it does not show on the email notification

Hi!

Can you clarify where you capture the customer PO? Is it stored as a cart attribute or during checkout?

Hi It is captured as a cart attribute

OK, you should be able to put this liquid drop in your email notification:

{{ order.attributes[“your-attribute-name”] }}

or

{{ attributes.your-attribtue-name }}

Hi all,

I am trying to apply exactly that on a clients store and I only get the title DISCOUNT instead of the real discount code PURE_SHIPPING
this:
“{% for discount_application in discount_applications %}
title: {{ discount_application.title }} : value: {{ discount_application.value }}
{% endfor %}”

Gives me: “title: Discount : value: 5.0”

I am a little frustrated since I am trying to do that for hours but cannot manage it.

Does anybody know a solution please?

Thanks,
Ramiz