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?
2
Answers
In notifications you may access to discount_application object as explained here:
https://shopify.dev/docs/themes/liquid/reference/objects/discount-application
So (not tested), something like that might work:
HTH
You can get it from your cookies: