Disabling quantity left on Virtual/digital products

Hello,

so I’ve added the following code to product-template.liquid to show that there are less than 10 items left in inventory.

{% assign stock = 0 %}              
              {% for variant in product.variants %}
              {%capture stock %}
              {{ stock | plus:variant.inventory_quantity }}
              {% endcapture %}
              {% endfor %}
              
              {%assign stock = stock | times:1%}

			{% if stock < 10 %}
           **Only {{stock}} available** 
			  {% endif %}

My only problem is that I don’t want it on digital/virtual products.

It is now showing a quantity of -## which when I checked seems to be the number of times the product was sold or something.

Is there any way to disable this rule to certain collections?

if needed here’s a link to one digital product

Thank you!

Use the {{variant.requires_shipping}} variable as per the below:

{% if variant.requires_shipping %}

Your Code

{% endif %}

Let me know if that works!

great prompt solution!
thanks, mate ^^

You’re welcome! Don’t forget to like & mark as a solution!