Zolo Digital
Let’s Connect
Back to Blog

September 28, 2026

The Liquid loop that's quietly slowing down your Shopify store

The Liquid loop that's quietly slowing down your Shopify store

The most common cause of slow Liquid rendering is a loop inside a loop: a collection loop, a tags loop and a blocks loop multiply into thousands of iterations for one product grid. Do the expensive work once before the loop, look values up inside it, and use limit and break to stop early.

Most Shopify speed advice is about images and apps. Those matter. But some stores are slow before the browser gets anything, because the theme takes too long to render on Shopify's servers.

What does the slow pattern look like?

{%- for product in collection.products -%} {%- for tag in product.tags -%} {%- for block in section.blocks -%} {%- if block.settings.tag == tag -%} {% render 'badge', text: block.settings.label %} {%- endif -%} {%- endfor -%} {%- endfor -%} {%- endfor -%}

Fifty products × ten tags × a dozen blocks is 6,000 iterations for one grid. It reads fine and works fine, and it's slow.

What should you write instead?

Do the expensive work once, outside the loop, then look things up inside it:

{%- liquid assign badge_tags = '' for block in section.blocks assign badge_tags = badge_tags | append: block.settings.tag | append: ',' endfor -%} {%- for product in collection.products -%} {%- for tag in product.tags -%} {%- assign needle = tag | append: ',' -%} {%- if badge_tags contains needle -%} {% render 'badge', text: tag %} {%- break -%} {%- endif -%} {%- endfor -%} {%- endfor -%}

Same result, a fraction of the work, and break stops as soon as there's a match.

Which other loop habits slow rendering?

Which Shopify limits should you know about?

Some slowness isn't a loop at all but a limit being hit quietly.

A checklist before you ship a section

How do you find the slow part?

Install the Shopify Theme Inspector for Chrome extension. It shows a flame graph of how long each Liquid file and section takes to render, so you fix the slowest thing first instead of guessing.

If your store feels slow and you're not sure why, I do Shopify speed work.