Sort by Quantity

26 0 11

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.



Replies 5 (5)

Shopify Partner
15 0 7

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.

8 0 1

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

Shopify Partner
15 1 5

Hi @Shane_15 

Just curiously, you mention this can be some if you have no variants.

We have no variants, every item is a singular amd separate. Is it easy to show LOWEST quantity products first in results? How can this be achieved?

Kind Regards!


29 0 14

Yes, this app does it: 


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.

Shopify Partner
56 5 12

Yes, just did a quick video tutorial on how you can sort collections by product inventory with the Dynasort App (, hope this helps.

The Dynasort App

Dynamic collection sorting based on your product attributes.