Display x amount left until discount – liquid

I want to show a message how much client needs to spend more until he gets additional discount. I have 4 discounts setup in shopify discounts. I achieved needed behaviour with liquid: {% assign discount1_threshold = 81 %} {% assign discount2_threshold = 61 %} {% assign discount3_threshold = 41 %} {% assign discount4_threshold = 20 %} {% if cart_total < discount4_threshold %} Amount until 5% discount {{ discount4_threshold | minus: cart_total }}€ {% elsif cart_total < discount3_threshold %} Amount until 2% discount {{ discount3_threshold | minus: cart_total }}€ {% elsif cart_total < discount2_threshold %} Amount until 3% discount {{ discount2_threshold | minus: cart_total }}€ {% elsif cart_total < discount1_threshold %} Amount until 2% discount {{ discount1_threshold | minus: cart_total }}€ {% else %} Congrats! You've reached maximum discount value. {% endif %} However, it needs to be refreshed everytime you add to cart to update the message. I've tried using JS but sadly couldn't make it work.

Comment (0)

You’ll be in good company