Debut Theme: Show Percentage OFF on Product Pages with variants

New Member
1 0 0

Hi,  

I have updated some code in the product-template.liquid file in the Debut theme per the instructions I found on different posts as follow as I wanted to have the percentage OFF shown next to the discounted price. I have products with variants:


{% if product.compare_at_price_max > product.price %}<font color="#da161e">
{{ product.compare_at_price_min | minus: current_variant.price | times: 100.0 | divided_by: product.compare_at_price_min | money_without_currency | times: 100 | replace: '.0', ''}}% OFF</font>{% endif %}  


The discount price and percentage are shown on the discounted variant item properly but it also appears on the variants which are not discounted and this with a wrong amount. 
Also when I refresh the page, the discount is not right anymore either on discounted or non-discounted variants.

How can I hide the % for the non-discounted variants? And how to resolve the issue appearing after refreshing the page?

Thanks

 

0 Likes
New Member
1 0 0

Did you figure out how to get the percentage off for the varients in debut?

0 Likes