Pregunta

This is the code I thought would work but it doesn't:

{% for discount in discounts %}
   {% if discount.code == 'testcoupon123' %} 
      You will get a free item!
   {% endif %}
{% endfor %}

Can anyone please explain what is wrong with this?

¿Fue útil?

Solución

I know from using email template codes the discount code field can be multiple discount code(s) for an order, see this document for the brief explanation:

http://docs.shopify.com/manual/settings/notifications/email-variables#discounts

Have you tried using: {% if discount.first.code == 'testcoupon123' %}

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top