Answers.Body: <p>Discounts can only be determined if the item is added to the cart. This is what separates a discount from a sale. </p>
  
  <p>A discount is actually not matched with the product but the line item as it sits on the order (with all of its context like the order's customer, etc)</p>
  
  <p>You can determine if something is on sale with <code>variant.onSale</code> returning true or false.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-11T12:51:56.217Z
Answers.Text: Thank you for the quick reply! I used sales but they don't seem to work. I have enabled a sale of 30% for a particular user group and a particular type of products and `product.defaultVariant.onSale` always returns false.
Answers.UserDisplayName: Panos Spiliotis
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-11T13:16:33.267Z
Answers.Text: A correction: The code seems to return true if a member of the particular group that the sale applies is logged in. However, I want to display the sale price to all visitors. ex. (Price: $25 - Price for members: $20). I hope that helps
Answers.UserDisplayName: Panos Spiliotis
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-14T03:39:34.597Z
Answers.Text: There is no way to access the sale price easily if the sale does not match the current user. You could always get the exact sale and its percentage and show the discount amount on the front end?
Answers.UserDisplayName: Luke Holder
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-15T07:56:11.220Z
Answers.Text: Luke, thank you for taking the time to respond. That's what I'm currently doing. The problems is that I have built an ajax cart for this site and in order to make everything work right now, I have to check if the user belongs to specific groups which is something that I want to avoid for obvious reasons. Let's hope an upcoming update will bring this functionality in Craft Commerce.
Answers.UserDisplayName: Panos Spiliotis
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-11T03:43:35.007Z
Answers.LastActivityDate: 2018-05-11T03:43:35.007Z
Answers.UserDisplayName: Luke Holder
Body: <p>I have set up a number of discounts using Craft Commerce. Those discounts apply to specific groups of users and types of products. </p>
  
  <p>Is there a way to know inside the template, if a discount is going to be applied without checking the product type or user group of the current user?</p>
  
Tags: <plugin-craftcommerce>
Title: Is there a way to know if a discount is going to be applied on a product?
ThreadText: # Is there a way to know if a discount is going to be applied on a product?
  
  (Asked by: username_0 on 2018-05-10)
  
  I have set up a number of discounts using Craft Commerce. Those discounts apply to specific groups of users and types of products.
  
  Is there a way to know inside the template, if a discount is going to be applied without checking the product type or user group of the current user?
  
  **Tags:** plugin-craftcommerce
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-05-11. Score: 1
  
  Discounts can only be determined if the item is added to the cart. This is what separates a discount from a sale.
  
  A discount is actually not matched with the product but the line item as it sits on the order (with all of its context like the order's customer, etc)
  
  You can determine if something is on sale with `variant.onSale` returning true or false.
  
  > **Comments:**
  > **username_0**: Thank you for the quick reply! I used sales but they don't seem to work. I have enabled a sale of 30% for a particular user group and a particular type of products and `product.defaultVariant.onSale` always returns false.  
  > **username_0**: A correction: The code seems to return true if a member of the particular group that the sale applies is logged in. However, I want to display the sale price to all visitors. ex. (Price: $25 - Price for members: $20). I hope that helps  
  > **username_1**: There is no way to access the sale price easily if the sale does not match the current user. You could always get the exact sale and its percentage and show the discount amount on the front end?  
  > **username_0**: username_1, thank you for taking the time to respond. That's what I'm currently doing. The problems is that I have built an ajax cart for this site and in order to make everything work right now, I have to check if the user belongs to specific groups which is something that I want to avoid for obvious reasons. Let's hope an upcoming update will bring this functionality in Craft Commerce.  
  
  ---
  
  