Reputation: 59
I am trying to sort the collections page, not the products in each collection. I have two collections, black and grey, and right now they're sorted alphabetically in ascending order.
Can I set the order to be descending or do I need to use a workaround?
Upvotes: 3
Views: 9284
Reputation: 11682
See the Shopify docs for list-collections.liquid:
Re-ordering the collections
When you loop through the collections array, the collections will be output in alphabetical order by default.
There may be instances where you want to re-order the collections listed or pick and choose which collections to display. In such cases, you can load the collections from a link list instead: see Taking control of the collections listing page for more information.
EDIT:
Taking control of the collections listing page:
...if you want your collections to be listed in a particular order (say, alphabetical), and you want better control over what collections are listed, use this code: http://gist.github.com/523455. That code snippet will not iterate over all collections in your shop. It will use the collections you will have listed in a link list. You will create a link list called "Featured Collections" on the Navigation page in your admin and you will add to it only the collections that you want and order those collections as you wish them to appear.
But if all you want to do is reverse the order, you can use the reversed
keyword. For example:
{% for collection in collections reversed %}
...
{% endfor %}
Upvotes: 3