How to use update variant.availability real-time

New Member
1 0 0

I'm attempting to use a simple line of {% if %} to reflect the availability of a variant. However, the code only seems to be looking at the first variant. Here's the code I have at the moment:


{% if variant.inventory_quantity > 1 %}
<p>IN STOCK</p>
{% endif %}

How can I force this to look at the currently selected variant and not just the first one?

Shopify Expert
2686 67 717


this will require adding some Javascript code. The exact location of code will depend on the theme you're using as they have different javascript.

You may have a look at this thread  as a starting point.

Want to hire me to tweak a theme? Mail me at!
My post solved your problem? Like it!
I am away till Feb-15.