Answers.Body: <p>I think you would probably also need to check the default variant of the product, e.g.:</p>
  
  <pre><code>{% if product.defaultVariant.onSale %}
    {% set price = product.defaultVariant.salePrice %}
  {% else %}
    {% set price = product.defaultVariant.price %}
  {% endif %}
  
  Product Price - {{ product.price }}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-20T14:14:00.227Z
Answers.LastActivityDate: 2017-03-20T14:14:00.227Z
Answers.UserDisplayName: Seth Warburton
Answers.Body: <p>I believe you can always simply use <code>product.defaultVariant.salePrice</code> as this will be set to equal <code>product.defaultVariant.price</code> if there is no sale applied.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-04T11:04:51.997Z
Answers.LastActivityDate: 2018-11-04T11:04:51.997Z
Answers.UserDisplayName: foamcow
Body: <p>How does one get the sale price of a product in Craft Commerce on a product page? I'm new to Craft and Twig and the <code>sale</code> section of the Commerce docs is.. well, not really there (page under construction). I have a product that has a sale set on it. I pull the single product without problem:</p>
  
  <pre><code>{% set product = craft.commerce.products({
      relatedTo: category,
      slug: craft.request.getSegment(3),
      status: 'live',
  }).first() %}
  
  Product Title - {{ product.title }}
  Product Price - {{ product.defaultPrice|commerceCurrency(cart.currency) }}
  </code></pre>
  
  <p>But a <code>{{ dump(product) }}</code> doesn't show any discount or sale values at all. I know the sale exists and is up; this returns my sale name:</p>
  
  <pre><code>{% for sale in craft.commerce.sales %}
      {{ sale.name }}
  {% endfor %}
  </code></pre>
  
  <p>And I know my product is a part of that sale, it shows it as a related sale on the product entry page. The sale is wide open (no expiry or start, just one product picked (the one that populates the page I'm testing)). All attempts at sales price result in a templating error: <code>{{ product.price }},{{ product.salePrice }},etc</code>.</p>
  
  <p>The only thing I can think is a nested loop and then conditionals... something like (pseudo code):</p>
  
  <pre><code>&lt;span class="price"&gt;
  {% for sale in sales %}
      {% for sale_product in sale.products %}
          {% if sale_product.sku == product.sku %}
              ... do some weird math?
              Check if % off or $ off and math it up with
              {{ product.defaultPrice }}?
          {% endif %}
      {% endfor %}
  {% endfor %}
  </code></pre>
  
  <p>And that is clearly not how this is supposed to be done. Thanks!</p>
  
  <p><strong>Edit</strong></p>
  
  <p>And for that matter, how do I check if it is on sale at all, regardless of the sale value? The client design involves slightly different coloring/styles for a sale price versus a default price.</p>
  
Tags: <templating><plugin-craftcommerce>
Title: Get sale price in Commerce
ThreadText: # Get sale price in Commerce
  
  (Asked by: username_0 on 2017-03-16)
  
  How does one get the sale price of a product in Craft Commerce on a product page? I'm new to Craft and Twig and the `sale` section of the Commerce docs is.. well, not really there (page under construction). I have a product that has a sale set on it. I pull the single product without problem:
  
  ```
  {% set product = craft.commerce.products({
      relatedTo: category,
      slug: craft.request.getSegment(3),
      status: 'live',
  }).first() %}
  
  Product Title - {{ product.title }}
  Product Price - {{ product.defaultPrice|commerceCurrency(cart.currency) }}
  
  ```
  
  But a `{{ dump(product) }}` doesn't show any discount or sale values at all. I know the sale exists and is up; this returns my sale name:
  
  ```
  {% for sale in craft.commerce.sales %}
      {{ sale.name }}
  {% endfor %}
  
  ```
  
  And I know my product is a part of that sale, it shows it as a related sale on the product entry page. The sale is wide open (no expiry or start, just one product picked (the one that populates the page I'm testing)). All attempts at sales price result in a templating error: `{{ product.price }},{{ product.salePrice }},etc`.
  
  The only thing I can think is a nested loop and then conditionals... something like (pseudo code):
  
  ```
  <span class="price">
  {% for sale in sales %}
      {% for sale_product in sale.products %}
          {% if sale_product.sku == product.sku %}
              ... do some weird math?
              Check if % off or $ off and math it up with
              {{ product.defaultPrice }}?
          {% endif %}
      {% endfor %}
  {% endfor %}
  
  ```
  
  And that is clearly not how this is supposed to be done. Thanks!
  
  **Edit**
  
  And for that matter, how do I check if it is on sale at all, regardless of the sale value? The client design involves slightly different coloring/styles for a sale price versus a default price.
  
  **Tags:** templating, plugin-craftcommerce
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2017-03-20. Score: 2 | Accepted answer
  
  I think you would probably also need to check the default variant of the product, e.g.:
  
  ```
  {% if product.defaultVariant.onSale %}
    {% set price = product.defaultVariant.salePrice %}
  {% else %}
    {% set price = product.defaultVariant.price %}
  {% endif %}
  
  Product Price - {{ product.price }}
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2018-11-04. Score: 2
  
  I believe you can always simply use `product.defaultVariant.salePrice` as this will be set to equal `product.defaultVariant.price` if there is no sale applied.
  
  
  ---
  
  