Show different message while the one variant is not available and the other variant is available

Highlighted
Tourist
4 0 0

Hi,

I have 2 variants in my product can be chose.

Variant 1 is out of stock and I would like it to show "Deliver in 3 weeks"

Variant 2 is available, I would like to show how many are still in the stock. 

So I put the following code in Sections > product.template.liquid

 

{% if current_variant.inventory_quantity >0 %} 
<p> <font color=#B22222> There are <strong class="variant-inventory">{{ current_variant.inventory_quantity }}</strong>left only.</font></p>  
{% else %} 
<p> <font color=#B22222> Deliver in 3 weeks</font></p>      
{% endif %}   

It actually partially worked if I refresh the page with the selected variants. But it still show the same format message if I didn't refresh the page.

Can anyone please advise? Thanks.

 

0 Likes