Sort single collection by inventory amount

Hello,

That’s certainly possible! There are two ways to achieve this:

  1. Via Javascript
    1.a. Check if this is the collection that you want to filter;
    1.b. If so, pass a HTML data-attribute with the amount with of product to the respective collection items
    1.c. Sort it using ES6’s sort function

2. Via .liquid using the sort filter

Feel free to e-mail me if you need further help!