I would like to do two things in my Craft commerce templates:

In my product template:

Check if there are any discounts available to a specific product.

I have a way to output discounts but need to be able to check if there are any at all because the pricing table would look entirely different for either one of the two cases.

In my shopping cart template:

I would like to check (1) if there are any discounts applied to a line item in the shopping cart and, if there are, (2) I would like to display the discount amount for that line item.

This way, I can avoid showing a zero discount like this: "Your discount: $0.00"

Thank you for your help.

  • If an answer provides a solution to your problem it's good etiquette, and good manners, to mark it as the correct answer. Jul 24, 2017 at 15:55

2 Answers 2


Something like this?

  {% if item.discount %}
    <td>Your discount is {{ item.discount|commerceCurrency( currency ) }}</td>
  {% endif %}

For some reason the {% if item.discount %} isn't working for me. I've solved it by comparing the item.discount value. If not 0.0000 then it may show up

{% if item.discount != '0.0000' %} 
  {{"Discount"|t}}: {{ item.discount|commerceCurrency(cart.currency) }}<br>
{% endif %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.