Top

Compare at Price isn't Showing when Running a Discount

A common question asked when running a sale with Product Discount, is that the compare at price is not displayed.

To show a compare at price, 2 things need to happen:

  1. The product has to have a compare at price listed.
  2. There needs to be code in the theme file to display the compare at price.

When Product Discount is on, it adds the regular price into the compare at price (if blank), otherwise it leaves the compare at price as-is.  

While several themes do have this code built-in to show the compare at price, other themes do not.

But the demo shows the compare at price! Why am I not seeing it?

The demo found here does show the price stroked out, and has the compare at price, using this piece of code:

<h2 id="price"><span>{{ product.price | money }}</span>{% if product.compare_at_price_max > product.price %} <del>{{ product.compare_at_price_max | money }}</del>{% endif %}</h2>

You may need to tweak it for your theme, but here is the breakdown of what is happening:

  • {{ product.price | money}} : This shows the regular selling price of the product.
  • {% if product.compare_at_price_max | money > product.price %}: Logic statement that will run the next lines of code if the highest (max) compare at price is higher than the product price. The {% endif %} closes the logic statement.
  • <del> ... </del> : The content between these tags will be stroked out.
  • {{ product.compare_at_price_max }} : The highest compare at price. This can also be modified as {{ product.compare_at_price_min }}, for the lowest (minimum) compare at, or simply {{ product.compare_at_price }}.
Have more questions? Submit a request