Page Nav

HIDE

Explore:

latest

How to Speed Up Your Shopify Plus Custom Theme: A Step-by-Step Guide

Introduction: Why Fast Performance Is Non-Negotiable A slow-loading Shopify Plus store can drive away customers, hurt search rankings, and s...


Introduction: Why Fast Performance Is Non-Negotiable


A slow-loading Shopify Plus store can drive away customers, hurt search rankings, and slash revenue. For businesses investing in a Shopify Plus custom theme or Shopify Plus store setup, speed isn’t just a luxury—it’s critical for staying competitive. Custom themes offer flexibility but often introduce code bloat, oversized media, and third-party app conflicts. This guide breaks down practical, technical steps to improve your store’s performance without sacrificing design or functionality.


1. Start by Measuring Your Store’s Current Speed

Before making changes, identify what’s slowing down your store. Use these tools:

  • Google Lighthouse: Generates reports on performance, accessibility, and SEO. Aim for a score above 90/100.
  • GTmetrix: Tracks metrics like Time to First Byte (TTFB) and Largest Contentful Paint (LCP).
  • Shopify’s Theme Inspector: Pinpoints theme-specific issues like unoptimized Liquid code.
Key Metrics to Watch:
  • Time to First Byte (TTFB): How quickly your server responds to requests. A TTFB under 500ms is ideal.
  • Largest Contentful Paint (LCP): Measures the loading speed of the largest image or text block. Target under 2.5 seconds.
  • Cumulative Layout Shift (CLS): Quantifies visual stability. Keep this below 0.1.

2. Clean Up Your Theme Code

Minify CSS, JavaScript, and HTML
Remove unnecessary spaces, comments, and line breaks from code. Tools like CSSNano or UglifyJS automate this process. Smaller files load faster.

Remove Unused Code and Features
Custom themes often include unused templates, libraries, or features. Delete redundant sections from the code editor or hire a developer to audit your theme.

Improve Liquid Code Efficiency
Shopify’s Liquid code can slow down rendering if misused. For example:
  • Avoid nested loops (e.g., looping through product variants inside collection loops).
  • Replace complex logic with Shopify’s built-in sections and snippets.
Limit Third-Party Apps
Apps add JavaScript that blocks page rendering. Test each app’s impact using Lighthouse before and after installation.

3. Optimize Images and Media

Compress Images Without Sacrificing Quality
Large images are a top cause of slow loading. Use tools like ImageOptim or Squoosh to reduce file sizes. For Shopify Plus stores, aim for:
  • Product images under 300 KB.
  • Hero banners under 500 KB.
Switch to Modern Formats Like WebP
WebP images are 30% smaller than JPEG/PNG. Convert existing images using Shopify’s bulk image optimizer or apps like Crush.pics.

Implement Lazy Loading
Delay loading images and videos until they’re visible on the screen. Add the loading="lazy" attribute to <img> tags or use a Shopify app like Lazy Load.

Host Videos Externally
Embed videos from YouTube or Vimeo instead of uploading them directly to Shopify. This reduces server strain.

4. Improve Browser and Server Caching



Caching stores copies of files to reduce server requests and speed up page loads. Here’s how to do it right:

Browser Caching
Set Expiry Headers: Configure your server to tell browsers how long to cache static files (CSS, JS, images). 
For example: Cache-Control: public, max-age=31536000  

This caches files for 1 year. Shopify’s CDN handles this by default, but check with tools like GTmetrix to confirm.

Version Static Files: Append version numbers to file names (e.g., styles-v2.css) to force browsers to fetch updated files.

Server-Side Caching
Shopify’s Built-In CDN: All Shopify Plus stores use a global CDN. No setup is needed, but ensure your theme references assets correctly (e.g., {{ 'script.js' | asset_url }}).

Third-Party CDNs: For more control, integrate Cloudflare:
  • Point your domain to Cloudflare’s nameservers.
  • Enable “Auto Minify” (under Speed > Optimization) to compress JS/CSS.
  • Set “Browser Cache Expiration” to 1 month (Caching > Configuration).
Liquid Caching for Dynamic Content
Shopify’s Liquid lets you cache sections that rarely change, like headers or footers:

liquid
{% cache "header" %}  
  <!-- Header code here -->  
{% endcache %}  
Avoid caching personalized content (e.g., cart counters, user-specific data).

5. Reduce Third-Party Script Overhead

Third-party scripts (analytics, chatbots, reviews) slow down pages by adding HTTP requests and JavaScript execution.

Audit Existing Scripts
Use Chrome DevTools’ Coverage Tool (Cmd+Shift+P > “Coverage”) to find unused JavaScript.

Ask:
  • Is this script necessary for the first page load?
  • Can it load after the page is interactive?
Load Scripts Efficiently
Async Loading: Use async for scripts that don’t depend on page elements (e.g., analytics):

html
<script src="analytics.js" async></script>  
Run HTML
Defer Loading: Use defer for scripts that need the DOM but not immediate execution (e.g., chatbots):

html
<script src="chatbot.js" defer></script>  
Run HTML
Delay Non-Critical Scripts: Load tools like live chats after a 3-second delay:

javascript
setTimeout(() => {  
  // Load script here  
}, 3000);  
Consolidate Tools
  • Replace multiple analytics tools with a single platform like Google Tag Manager.
  • Use Shopify’s native Shopify Scripts for cart adjustments instead of third-party apps.

6. Advanced Tweaks for Shopify Plus Stores

Checkout Customizations
Shopify Plus allows checkout edits, but heavy changes hurt speed.

Limit Custom JavaScript: Avoid adding scripts to checkout.liquid unless absolutely necessary.

Use Checkout Extensions: Shopify’s post-purchase upsells run on separate servers, so they don’t slow down the main checkout.

Database Cleanup
A bloated database increases admin load times and API delays.

Delete Unused Products/Collections: Export a CSV of products, filter by “Published” status, and remove drafts/old items.

Trim Metafields: Use apps like Metafields Editor to delete unused metafields. Too many metafields slow GraphQL queries.

GraphQL for Faster Data Retrieval
GraphQL fetches specific data in one request, unlike REST APIs. For example:

graphql
query {  
  product(handle: "blue-shirt") {  
    title  
    priceRange {  
      maxVariantPrice {  
        amount  
      }  
    }  
  }  
}  
This retrieves only the product title and price, reducing payload size.

Preload Critical Resources
Add preload tags to your theme’s <head> to prioritize key assets:

html
<link rel="preload" href="{{ 'theme.css' | asset_url }}" as="style">  
<link rel="preconnect" href="https://fonts.shopifycdn.com">  
Run HTML

7. Test and Monitor Changes

Optimization is ongoing. Track performance post-launch with:

Automated Monitoring Tools
New Relic: Tracks server response times and JavaScript errors. Set alerts for TTFB spikes.

Pingdom: Monitors uptime and page speed across global locations.

Shopify’s Performance Dashboard: Check “Online Store Speed” under Analytics for Shopify-specific metrics.

A/B Testing
Use tools like Google Optimize to compare conversion rates before/after optimizations. For example:
  • Test a simplified product page against the original.
  • Measure how lazy loading impacts bounce rates.
Monthly Audits
  • Re-run Lighthouse and fix new issues (e.g., image compression drift).
  • Review third-party apps: Uninstall any added in the last month that hurt speed.

8. Common Pitfalls to Avoid

Ignoring Mobile-First Design
Test on Real Devices: Use Chrome DevTools’ Device Mode to simulate 3G speeds.

Optimize Mobile Media: Serve smaller images for mobile using srcset:

html
<img src="large.jpg"  
     srcset="small.jpg 500w, medium.jpg 1000w"  
     sizes="(max-width: 600px) 500px, 1000px">  
Run HTML
Skipping Theme Updates
Review Release Notes: Shopify updates themes for security and performance. Merge changes carefully to avoid conflicts.

Use a Staging Theme: Duplicate your live theme, test updates, then deploy.

Overloading Pages with Apps
  • Test App Impact: Install one app at a time and measure Lighthouse scores.
  • Replace Apps with Native Features: For example, use Shopify’s Shopify Forms instead of third-party form builders.


Final Tips for Long-Term Success

  • Schedule Quarterly Cleanups: Remove unused apps, compress new images, and audit code.
  • Use Shopify Plus Support: The 24/7 Shopify Plus team helps troubleshoot performance bottlenecks.
  • Consider Headless Commerce: For enterprise stores, pair Hydrogen (React-based framework) with Shopify Plus for faster, decoupled frontends.

Ready to Build a Blazing-Fast Shopify Plus Store?

Achieving peak performance for a Shopify Plus store requires technical expertise, especially when balancing custom themes with speed. If you’re looking for a partner to handle complex setups, code optimizations, or ongoing maintenance, CartCoders offers specialized Shopify Plus store setup services tailored to high-growth brands. Their team ensures your custom theme runs smoothly while adhering to performance best practices. For personalized guidance or to discuss your project, contact our Shopify Plus experts today.

No comments