Liquid, JavaScript, themes, sales channels
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
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.
Please help me i need sort menu by available inventroy high to low and low to high
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!
Matt
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.
Yes, just did a quick video tutorial on how you can sort collections by product inventory with the Dynasort App (https://apps.shopify.com/dynasort), hope this helps.
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024