Good Day,
anyone know how to change the on-sale badge to % off?
I found this code, logic makes sense to me. But Iam unable to find:
{{ 'products.product.on_sale' | t }}
{% if product.variants.size > 1 %}
UP TO {{ product.compare_at_price_min | minus: product.price | times: 100.0 | divided_by: product.compare_at_price_min | money_without_currency | times: 100 | replace: '.0', '' | append: "% OFF"}}
{% else %}
{{ product.compare_at_price_min | minus: product.price | times: 100.0 | divided_by: product.compare_at_price_min | money_without_currency | times: 100 | replace: '.0', ''| append: "% OFF"}}
{% endif %}
Iam not interested into an App.
When someone knows where to put it feel free. Thx
Solved! Go to the solution
This is an accepted solution.
Found it,
Here is the new code: The code now shows -70%
{{ product.compare_at_price | minus: product.price | times: 100 | divided_by: product.compare_at_price | replace: '0,', '' | prepend: "-" | append: "%" }}
replace this:
{{ 'product.labels.on_sale' | t }}
Can be found: product item liquid, line around 70 depending on your code.
Best
User | Count |
---|---|
546 | |
209 | |
125 | |
81 | |
41 |