문제

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?

도움이 되었습니까?

해결책

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' %}

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top