How to show in stock inventory on products by third party vendors

I’m using this code in my product-template.liquid to show in stock inventory for products and their variants:

{% comment %} Inventory tracking on product page {% endcomment %}
          	{% for variant in product.variants %}
                

            {% endfor %}
          
          	
            
              {% if current_variant.inventory_management == "shopify" and current_variant.inventory_policy != "continue" %}
              We have **{{ current_variant.inventory_quantity }}** in stock.
              {% else %}
              {% endif %}
            

{% comment %} END inventory tracking on product page {% endcomment %}​

It works perfectly for products I’m the vendor of, but for products by third party vendors, it doesn’t list any quantities on those product pages. Does anyone know how I can alter this code, or alter any code, so that this code works with third party vendor products?

1 Like