Answers.Body: <p>You currently can not know if a product matches a discount until it is added to the cart and the discount engine does the checks based on the full conditions of the discount. Many conditions of which are directly related to the product being in the cart. For example a minimum order qty.</p>
  
  <p>But if you want to return a possible list of discounts to show the custom of which the product MAY be eligible before adding to the cart then you can do something like this:</p>
  
  <pre><code>{% for discount in craft.commerce.discounts %}
    Possible Discounts:&lt;br&gt;
    {% if product.id in discount.productIds or product.typeId in discount.productTypeIds %}
      {{discount.description}}&lt;br&gt;
    {% endif%}
  {% endfor %}
  </code></pre>
  
  <p>This only checks the product and it's product type is explicitly listed in the discount, but you can add additional conditions if you wished.</p>
  
  <p>It is recommended the discount description has a readable sentance for how this discount could be applied. For example:</p>
  
  <blockquote>
    <p>Buy 2 or more sneakers and get 75% off.</p>
  </blockquote>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-06T07:37:13.503Z
Answers.Text: You should correct the OR operator from `||` to `or`
Answers.UserDisplayName: Amit Erandole
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-06T05:26:52.103Z
Answers.LastActivityDate: 2016-07-06T15:25:01.957Z
Answers.LastEditDate: 2016-07-06T15:25:01.957Z
Answers.UserDisplayName: Luke Holder
Body: <p>How do I show possible discounts available to the current product?</p>
  
Tags: <plugin-craftcommerce>
Title: How can I know the discounts available to a product before adding it to the cart?
ThreadText: # How can I know the discounts available to a product before adding it to the cart?
  
  (Asked by: username_0 on 2016-07-06)
  
  How do I show possible discounts available to the current product?
  
  **Tags:** plugin-craftcommerce
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-07-06. Score: 2
  
  You currently can not know if a product matches a discount until it is added to the cart and the discount engine does the checks based on the full conditions of the discount. Many conditions of which are directly related to the product being in the cart. For example a minimum order qty.
  
  But if you want to return a possible list of discounts to show the custom of which the product MAY be eligible before adding to the cart then you can do something like this:
  
  ```
  {% for discount in craft.commerce.discounts %}
    Possible Discounts:<br>
    {% if product.id in discount.productIds or product.typeId in discount.productTypeIds %}
      {{discount.description}}<br>
    {% endif%}
  {% endfor %}
  
  ```
  
  This only checks the product and it's product type is explicitly listed in the discount, but you can add additional conditions if you wished.
  
  It is recommended the discount description has a readable sentance for how this discount could be applied. For example:
  
  > Buy 2 or more sneakers and get 75% off.
  
  > **Comments:**
  > **username_1**: You should correct the OR operator from `||` to `or`  
  
  ---
  
  