Show saved amount / discount percentage dynamically with variant options

Hi guys, currently I’ve been using a very good liquid work that shows the saved amount / discount percentage underneath the product price on Single Product page.

Something like this:

You save {{ product.compare_at_price | minus: product.price | money }} ({{ product.compare_at_price | minus: product.price | times: 100.0 | divided_by: product.compare_at_price | round }}%)

However, products with more than one variants, I need to adjust the liquid above to dynamically change with different variants. Currently it is static, meaning it will only display the saved amount and discounted percentage to the 1st variant showed on the Single Product page.

Even when there is no Compare at Price price, it still shows up.

Thank you.

Hi @tinooze ,
Please share your website URL.

Hi there, you can find it here: Link

Hi, I see you have managed to fix it. I have the same problem. Please can you send me the code for this?