Why collections.all Makes Your Shopify Store Take 30 Seconds to Load
collections.all is the most damaging performance antipattern in Shopify Liquid. It loads every single product in your store into memory during template rendering. A store with 1,000 products loads all 1,000 every time any template containing this object renders. Response times of 10-30 seconds are common. On stores with 10,000+ products, it causes timeout errors. This guide explains precisely why it is so destructive and gives you every replacement pattern you need.
What collections.all actually does at render time
collections.all is a Liquid global that returns the entire product catalog as an array. Unlike accessing a specific collection — which executes a bounded, indexed database query — collections.all has no upper bound. Shopify's rendering engine fetches every product record from the database, hydrates it into a Liquid product object, and holds the entire set in memory for the duration of the render. On a store with 5,000 products, this is 5,000 database records loaded synchronously. Render time scales linearly — each product adds 1-2ms, turning a 100ms render into a 5-10 second wait.
Where collections.all appears most often
Most common misuses: building a mega-menu by iterating all collections ({% for collection in collections.all %}), displaying featured products by looping all products ({% for product in collections.all.products %}), checking if a product exists anywhere in the catalog, and building search-like functionality in Liquid. Every one of these patterns has a correct alternative that does not require loading the full catalog.
Replacing collections.all with section collection settings
For any section that displays products, add a collection picker in schema: {"type":"collection","id":"featured_collection","label":"Collection"}. Then in Liquid: {% assign target = section.settings.featured_collection %}{% for product in target.products limit: 8 %}. This executes a single bounded database query for exactly the products needed. The performance difference is enormous — sub-100ms instead of 10+ seconds.
When you need all products — use pagination
If your page design requires showing all products, use Shopify's {% paginate %} tag: {% paginate collection.products by 24 %}{% for product in collection.products %}{% endfor %}{% endpaginate %}. The paginate tag ensures only 24 products are loaded per render regardless of catalog size. This is the only acceptable pattern for full-catalog display — never render more than 24-50 products per page without paginating.
The fix: before and after
// CODE_COMPARISON
Frequently asked questions
- How much does collections.all slow down my store?
Under 100 products: 100-500ms additional render time. 1,000 products: 2-5 seconds. 5,000 products: 10-20 seconds, often causing HTTP timeout errors. 10,000+: consistent timeouts and blank pages. The degradation is linear and unavoidable given how the object works internally.
- Does Shopify Theme Check warn about collections.all?
Theme Check does not have a specific rule for collections.all usage. Syphio and performance-focused auditing tools flag it as a CRITICAL performance issue. The safest approach is a code review policy prohibiting collections.all in any non-paginated context.
- Can I use limit to reduce the load from collections.all?
No. {% for product in collections.all.products limit: 8 %} still loads the entire catalog into memory before applying the limit. Limit is applied in Liquid after the database fetch — not at the query level. Specific collection references and section settings are the only ways to reduce the database load.
// SCAN_YOUR_CODE
Does your theme have this bug?
Paste your code. Syphio automatically detects and fixes this error and hundreds of others — in seconds.
Validate my Liquid →