Add a "you save this many dollars" on each variant

Highlighted
New Member
2 0 0

Hello!

I want to show the savings my customers will achieve with each variant. I can do savings for the product, but it shows the "ultimate" saving possible and whenever I change product to variant, it just does not work. 

 

I have been playing with a lot of codes and am a bit delirious. I have been playing with such codes to no available.

(This one is for a percentage.)

{% if variant.compare_at_price> variant.price %}You save {{ variant.compare_at_price | minus: variant.price | times: 100.0 | divided_by: variant.compare_at_price | money_without_currency | times: 100 | remove: '.0'}}%{% endif %}

And

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

{% capture discount %}

{{ current_variant.compare_at_price | minus:current_variant.price }}

{% endcapture %}

<span id="newDiscount">{{discount}}</span><br/>

{% endif %}

Any advice would be wonderful. 

Thank you! 

0 Likes