How to show quantity on collection page - Dawn Theme

Solved

How to show quantity on collection page - Dawn Theme

jschenck
Visitor
3 0 0

How do I get my collections pages to show the quantity of the items? I want the collections pages to show the quantities of the items in grid view so the customer doesn't have to click into the item to see how many units there are.

Accepted Solutions (2)

LuffyOnePiece
Shopify Partner
645 93 116

This is an accepted solution.

Hi @jschenck ,

 

Follow the below steps:

  1. Go to edit code
  2. Find card-product.liquid
  3. Add below code just below the title.
              {% assign total_inventory = 0 %}
              {% for variant in card_product.variants %}
                {% assign total_inventory = total_inventory | plus: variant.inventory_quantity %}
              {% endfor %}
              
              ({{ total_inventory }})

 

LuffyOnePiece_0-1717211666797.png

 


Please don't hesitate to reach out if you need further help optimizing or customizing your store. If you find this information useful, a Like would be greatly appreciated. And if this solves the problem, please Mark it as Solution!

 

Best Regards,
LuffyOnePiece

Sandeep Pangeni
Need help with your store? sandeeppangeni17@gmail.com
For quick response, Contact In WhatsApp +9779867521184

View solution in original post

LuffyOnePiece
Shopify Partner
645 93 116

This is an accepted solution.

Hi @jschenck ,

 

Add the below code to make Available in the new line.

              {% assign total_inventory = 0 %}
              {% for variant in card_product.variants %}
                {% assign total_inventory = total_inventory | plus: variant.inventory_quantity %}
              {% endfor %}
              
              <br/> Available: {{ total_inventory }}

 

We can't add the filter for the Quantity in the sorting.

 

Thank you

Sandeep Pangeni
Need help with your store? sandeeppangeni17@gmail.com
For quick response, Contact In WhatsApp +9779867521184

View solution in original post

Replies 6 (6)

LuffyOnePiece
Shopify Partner
645 93 116

This is an accepted solution.

Hi @jschenck ,

 

Follow the below steps:

  1. Go to edit code
  2. Find card-product.liquid
  3. Add below code just below the title.
              {% assign total_inventory = 0 %}
              {% for variant in card_product.variants %}
                {% assign total_inventory = total_inventory | plus: variant.inventory_quantity %}
              {% endfor %}
              
              ({{ total_inventory }})

 

LuffyOnePiece_0-1717211666797.png

 


Please don't hesitate to reach out if you need further help optimizing or customizing your store. If you find this information useful, a Like would be greatly appreciated. And if this solves the problem, please Mark it as Solution!

 

Best Regards,
LuffyOnePiece

Sandeep Pangeni
Need help with your store? sandeeppangeni17@gmail.com
For quick response, Contact In WhatsApp +9779867521184
jschenck
Visitor
3 0 0

Thank you, @LuffyOnePiece! I have 2 follow-up questions:

  • is it possible to display the quantity as a separate line on product card on the Collections page? Something like the below:
    • Product Name
    • $499.00 USD
    • Available: 15
  • Is it possible to add quantity as a filter on the Collections page? I can currently sort by Best Selling, Alphabetically, Price, and Date Added - can I add Quantity to that?

Thanks again!

LuffyOnePiece
Shopify Partner
645 93 116

This is an accepted solution.

Hi @jschenck ,

 

Add the below code to make Available in the new line.

              {% assign total_inventory = 0 %}
              {% for variant in card_product.variants %}
                {% assign total_inventory = total_inventory | plus: variant.inventory_quantity %}
              {% endfor %}
              
              <br/> Available: {{ total_inventory }}

 

We can't add the filter for the Quantity in the sorting.

 

Thank you

Sandeep Pangeni
Need help with your store? sandeeppangeni17@gmail.com
For quick response, Contact In WhatsApp +9779867521184
jschenck
Visitor
3 0 0

Thank you @LuffyOnePiece! Very helpful!

DecoDean1
Visitor
2 0 0

Hello Luffy,

I followed your instructions and I can't get this to work.

I am trying to get my total invnetory amount to show on my collections presentations.

Here is the code I used from this discussion:

 

{{ card_product.title | escape }}
{% assign total_inventory = 0 %}
{% for variant in card_product.variants %}
{% assign total_inventory = total_inventory | plus: variant.inventory_quantity %}
{% endfor %}

({{ total_inventory }})


</a>
</h3>
</div>

 

Any ideas? 

Here is a screen cap of the collection presentation

https://prnt.sc/ednyJN63Y_Bi

Here is what shows when I click on a product 

https://prnt.sc/TF_JLWS6umP9

 

The site is GolfballMonster.com

I am using Dawn 15.1.0

 

Thanks!

 

LuffyOnePiece
Shopify Partner
645 93 116

Hi @DecoDean1 ,

 

Can you please let me know which theme you are using so that I can help you out?

 

Thank you

Sandeep Pangeni
Need help with your store? sandeeppangeni17@gmail.com
For quick response, Contact In WhatsApp +9779867521184