A little bit of code

Solved
Tourist
23 0 3

Hello 

Is there anybody that knows a little bit about code ? I'm trying to add a little functionnality : When I have a product on sale I want to show the amount the customer save in %

So I add the code and everything is correct but when the product is not on sale here is what I have (please see screenshot below)

I tried to add some code by myself but it doesn't work :

{% if product.compare_at_price != "0"%}
 <span class="saved-amount"><h4 style="font-size :18px">Soit {{ product.compare_at_price | minus: product.price | times: 100 | divided_by: product.compare_at_price }}% d'économies</h4></span>
{% endif %}

If you have any advice I would be really greateful.
Thank you guys

 

0 Likes
Highlighted

Success.

Shopify Partner
1838 173 569

Use

{% if product.compare_at_price > product.price %}

Instead of 

{% if product.compare_at_price != "0"%}

Bonne chance!

I turn coffee in to code - since 1998
0 Likes