Example Website: https://snugshark.co/products/sharkblanket
My Website : https://charmente.com/
A user wants to replace the default “Sale” badge on product pages with a percentage discount tag, similar to an example website they referenced.
Solution Provided:
Another user offered step-by-step instructions:
{%- if show_badges -%} and replace the existing code blockTechnical Details:
The solution involves modifying Liquid template code to calculate the percentage difference between the compare-at price and current price, then displaying it as a formatted discount badge. The code snippets provided appear partially corrupted in the original post but indicate the general approach for this customization.
Status: Solution offered but requires technical implementation by the original poster.
Hi @Simon159
To show the percentage discount instead of the sale badge follow the below steps
From
{%- if show_badges -%}
{{ 'products.product.on_sale' | t }}
{{ 'products.product.sold_out' | t }}
{%- endif -%}
to
{%- if show_badges -%}
{{ 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
{{ 'products.product.sold_out' | t }}
{%- endif -%}
And add below CSS code to component-price.css
.price__badge-sale svg {
height: 10px;
}