Change Sale Badge to show Percent OFF

Pau_Oliver
Tourist
16 0 1

Is it possible to change it? I found the code of the sale tag in the product page: 

{% if settings.sale_banner_enabled and product.compare_at_price_max > product.price %}
        <div class="sale_banner_product">{{ 'collections.general.sale' | t }}</div>
      {% endif %}

I'm not entirely sure of what I should change here to show the %.

This is the Turbo Theme, by Portland

0 Likes
Pau_Oliver
Tourist
16 0 1
<div class="sale_banner_product">{{ 'collections.general.sale' | t }}
    {% if product.compare_at_price_max > product.price %} {{ product.compare_at_price_max | minus: product.price | times: 100.0 | divided_by: product.compare_at_price_max | money_without_currency | times: 100 | remove: '.0'}}%
        OFF</div>

 

0 Likes
Dani_Guti
Tourist
4 0 2

Hi! 

This finally works for you? 
I tried but wen I saved the code shows me this error :

  • Line 228 — Liquid syntax error: 'schema' tag must not be nested inside other tags

 

Do you know how can I fix this? I need to make the same and I have the same Turbo theme

 

Thanks!

0 Likes