Answers.Body: <p>Something like this?</p>
  
  <pre><code>  {% if item.discount %}
    &lt;tr&gt;
      &lt;td&gt;Your discount is {{ item.discount|commerceCurrency( currency ) }}&lt;/td&gt;
    &lt;/tr&gt;
    {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-11T08:30:20.390Z
Answers.LastActivityDate: 2017-04-11T08:30:20.390Z
Answers.UserDisplayName: Seth Warburton
Answers.Body: <p>For some reason the <code>{% if item.discount %}</code> isn't working for me.
  I've solved it by comparing the item.discount value. If not 0.0000 then it may show up</p>
  
  <pre><code>{% if item.discount != '0.0000' %} 
    {{"Discount"|t}}: {{ item.discount|commerceCurrency(cart.currency) }}&lt;br&gt;
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-17T09:44:01.197Z
Answers.LastActivityDate: 2017-08-17T09:44:01.197Z
Answers.UserDisplayName: iDzine
Body: <p>I would like to do two things in my Craft commerce templates:</p>
  
  <p><strong>In my product template:</strong></p>
  
  <p>Check if there are any discounts available to a specific product.</p>
  
  <p>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.</p>
  
  <p><strong>In my shopping cart template:</strong></p>
  
  <p>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.</p>
  
  <p>This way, I can avoid showing a zero discount like this:
  "Your discount: $0.00"</p>
  
  <p><em>Thank you for your help.</em></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-07-24T15:55:22.150Z
Comments.Text: If an answer provides a solution to your problem it's good etiquette, and good manners, to mark it as the correct answer.
Comments.UserDisplayName: Seth Warburton
Tags: <plugin-craftcommerce><discounts>
Title: Check if there is a discount and, is yes, how much
ThreadText: # Check if there is a discount and, is yes, how much
  
  (Asked by: username_0 on 2017-03-30)
  
  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.*
  
  **Tags:** plugin-craftcommerce, discounts
  
  > **Comments:**
  > **username_1**: If an answer provides a solution to your problem it's good etiquette, and good manners, to mark it as the correct answer.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2017-04-11. Score: 2
  
  Something like this?
  
  ```
    {% if item.discount %}
    <tr>
      <td>Your discount is {{ item.discount|commerceCurrency( currency ) }}</td>
    </tr>
    {% endif %}
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2017-08-17. Score: 1
  
  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 %}
  
  ```
  
  
  ---
  
  