Add a discount message "You save % ($) at product page with multiple variants

New Member
1 0 0

Hi, I am currently using Debut theme and I google it and found a code to add the said discount message in the product page, it works for a single variant but not working on multiple variants as it doesn't update the discount figures, does anyone could help me out with this?

Here is the code I am currently using, I added it into product-price.liquid

{% if product.compare_at_price_max > product.price %}You Save {{ 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'}}% {% endif %}
{% if product.compare_at_price > product.price %}({{ product.compare_at_price | minus: product.price | money_with_currency}}){% endif %}