more than 1000 Collections - how to get the right subset {% for collection in collections %}

JohannesKutsam
Visitor
2 0 0

Hi,

I use 

{% for collection in collections reversed%}

{% if collection.image and collection.title contains "ABC" %}
 <div> output do something for each collection containing ABC </div>

to get a subset of collections matching the criteria.This worked fine until the total Nr. of collections grew ++ 1000+++   in the collections list only 1000 are contained (or the loop stops after 1000 i don't know which). Unfortunately the "reversed" parameter does not give me the "latest" (newest) collections; the cutoff seems to be done before reversed is applied.

The result is - I don't get a complete list of my ABC collections.


in the documentation here: https://shopify.dev/docs/themes/liquid/reference/objects#collections  I find nothing about the cutoff after 1000 collections

Any help much appreciated.

The wanted output is a list of collections images with links to the collections: 
https://mode-erleben.at/pages/empfehlung
every collection is an "outfit" - a bundle of manually selected items.


Is there a way to filter BEFORE the loop starts?

 

Replies 2 (2)

Jason
Shopify Expert
11190 225 2282

Is there a way to filter BEFORE the loop starts?

No.

 

find nothing about the cutoff after 1000 collections

The maximum number of items you'll get in any Liquid= Drop will be 1000 items.
I don't see doing this in Liquid as an efficient method. Especially if you have well over 1000 collections to try and sort/filter.

A JavaScript (with AJAX) approach is likely going to get better, as would something that uses Menus (linklists). At least with a menu you can easily define what collection is part of the group and change the order in which they show quite easily.

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
JohannesKutsam
Visitor
2 0 0
ok, but that means i have to create the linklists manually (or via api)
before - and it cannot be done on the fly, correct?

my workaround for the moment is to delete old collections that are not
needed anymore, maybe archiving would work too - i haven't tried that yet.