Shopify Theme Performance Tips
A quick checklist to ensure your custom Liquid theme scores perfectly on Google PageSpeed Insights.
Share with Shopify developers — useful guides spread faster in theme dev communities.
Performance is more than PageSpeed scores
Fast themes limit server-side Liquid work, load assets intentionally, and account for apps that inject scripts at runtime. A practical implementation usually needs a staging duplicate with the same apps enabled—not localhost alone.
Liquid rendering budget
- Avoid triple-nested loops over products, variants, and metafields
- Use
limit:on homepage collection rows - Paginate collection and blog templates—50-item cap is silent
- Split heavy cross-sell sections from decorative bands on
product.json
Images and assets
Hero LCP images should be eager-loaded and correctly sized. Below-fold grids use lazy loading. Details: Image Optimization Guide.
JavaScript discipline
{% if template.name == 'product' and section.settings.enable_zoom %}
<script src="{{ 'product-zoom.js' | asset_url }}" defer></script>
{% endif %}
Load slider and zoom libraries per template and setting—not globally in theme.liquid unless truly universal. Never duplicate <script> tags inside block loops.
App impact
Review widgets, popups, and tracking pixels added after theme launch inflate JavaScript on production. Test Lighthouse on staging with apps enabled before sign-off.
Section Rendering API
For cart drawers and quick views, fetch one section's HTML via Shopify's Section Rendering API instead of full page HTML.
Pre-launch checklist
- Mobile Lighthouse on staging with apps on
- Section count sane on product and collection JSON templates
- No deprecated
img_urlin changed files - Preconnect to
cdn.shopify.comintheme.liquid
Takeaway
Treat Liquid loops, image markup, and script loading as a performance budget. Patterns: Cheat Sheet performance category.
Performance is a section architecture problem
Adding twenty heavy sections to product.json hurts mobile scores more than micro-optimizing one filter. Split decorative bands from data-heavy cross-sell modules. Defer below-fold video until interaction. Count sections on critical templates before blaming the parent theme.
Liquid render limits in practice
Triple-nested loops over products, variants, and metafields timeout on large catalogs. Flatten logic—precompute in snippets, limit iterations, paginate collection templates. If a section needs hundreds of iterations, question whether it belongs on the storefront template at all.
App and script discipline
{% if template.name == 'product' and section.settings.enable_zoom %}
<script src="{{ 'product-zoom.js' | asset_url }}" defer></script>
{% endif %}
Load assets conditionally per template and setting—not globally in theme.liquid unless truly universal.
Pre-launch checklist
- Lighthouse mobile on staging with apps enabled
- Hero LCP image eager-loaded, sized correctly
- Section count sane on product and collection JSON
- No duplicate slider scripts inside block loops
Agency gate: performance checklist before launch.
Topic cluster
Theme Development
Dawn, performance, images, and production theme workflows.
Practice in the converter workspace
Optional utility after you understand sections—draft Liquid with schema and blocks.
Share
Share this guide
Found this guide useful? Share it with other Shopify developers on LinkedIn, X, or Reddit.