Sort by Quantity

Highlighted
Tourist
12 0 4

Anybody know of any method or app that allows you to sort collection pages by amount of inventory?

 

We want to show products with the highest amount of stock first on the page.

 

Thanks

0 Likes
Highlighted
Shopify Partner
15 0 6

This can't be done very easily unless none of your products have variants. You can sort by 'available':

{% assign products = collection.products | sort: 'available' %}
{% for product in products %}
  <h4>{{ product.title }}</h4>
{% endfor %}

 

But this is only whether all of your variants are out of stock or not. 

 

For each product you would need to check the inventory of 1 or more variants. Check out the Shopify product object, where you will find the product.variants property, there you can then check each variant's inventory. The easiest way to sort them would be to create a metafield for each product that holds the total inventory for the product, which you can then sort by that meta field value.

0 Likes
Highlighted
Excursionist
13 0 7

Yes, this app does it:

https://apps.shopify.com/resort 

 

It will need to use the manual/featured sort option to create it.  You can simply rename the manual/featured sort in Edit Theme Language.

 

One drawback is that they app makes this new sort to the default sort and you can not change that.  We only want it to be an option and not to override the default sorts set on the collections, so we had to delete the app.

0 Likes
Highlighted
New Member
8 0 0

Capture.JPGPlease help me i need sort menu by available inventroy high to low and low to high

0 Likes