How to dynamically update text with Liquid Coding on cart page?

Hey there beautiful people!

Hope you’re having a great day!

I have a question related to Shopify Liquid Coding, and I’m hoping that you can help me out a little bit!

Basically, I want to have a text dynamically update when a customer increments the quantity of a product on the cart page, without the page restarting. ( Kind of, like, how the price updates on the cart page when someone increases the quantity of a product, without the page restarting.)

This is what I’ve done so far:


 	      {% if cart.item_count == 1 %}
        

Add another item for 5% discount!

        {% elsif cart.item_count == 2 %}
        

Add another item for 10% discount!

        {% elsif cart.item_count == 3 %}
        

Add another item for 15% discount!

        {% elsif cart.item_count >= 4 %}
        

Hooray! Maximum discount reached!

        {% endif %}

And this actually works, but only if I refresh the page.

What do you think? And ideas?

@alexlaslau – you’re half way there, but you need to update the container dynamically using JS, when the input options change. The implementation depends on your theme …

Hope this helps,
Mario

@r8r Thank you so much for answering! I’m actually using the Debut theme. How should I address this?

@alexlaslau – have you solved this yet?