Try Shopify for free, and explore all the tools and services you need to start, run, and grow your business.

How to show total number of variants of product?


Step 1: Login to your shopify store

Step 2: Click on Online store > Themes

Step 3: From the Actions drop-down select Edit code.

Step 4: Open a file where you want show total number of variant of product

Step 5 : Paste this code :

  <!---show total number of variants available -->
   {% assign num = 0 %}
    {% assign temp = 0 %}
    {% for variant in product.variants %}
       {% if variant.available %}       
          {% capture temp %}{{ num | plus: 1 }}{% endcapture %} 
       {% endif %}
    {% assign num = temp %}
    {% endfor %}  
 {{ num }}  Available


Step 6: Save

Try Shopify for free, and explore all the tools and services you need to start, run, and grow your business.

How to show total number of variants of product? How to show total number of variants of product? Reviewed by Navjeet Singh on January 21, 2019 Rating: 5

No comments:

Powered by Blogger.