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?

0 Likes
Shopify Partner
2567 39 583

Matthew, 

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 tairli@yahoo.com! My post solved your problem? This is my Paypal too :)
0 Likes