← Back to the blog

Performance

Speed without a redesign: how we took a Shopify store from 3.5s to 2s

An old theme, a JavaScript library on every page, and no budget for a redesign. Here's how we rebuilt a Shopify store section by section and cut its load time from about 3.5 seconds to about 2.

When a Shopify store feels slow, the answer it usually gets is a redesign. New theme, new look, a few months of work, and a launch date everyone is nervous about.

I lead ecommerce development for a US DTC brand whose store had that exact problem. It loaded in about 3.5 seconds, and Shopify’s performance dashboard sat in yellow and red. We didn’t redesign it. Over about two months, working alongside normal day to day tasks, we rebuilt it one section at a time. Load time dropped to about 2 seconds and the dashboard turned green.

Shoppers never saw a new store. They just stopped waiting for this one.

Here’s what was slowing it down, what we changed, and how you can tell if your store has the same problem.

What we started with

Two things were doing most of the damage.

An old theme architecture. The store ran on Shopify’s original theme system, Online Store 1.0. In those themes, templates are plain Liquid files, and sections only really live on the home page. Everything else is hardcoded. That makes it hard to control what loads where, so most themes from that era ship one big JavaScript file and one big stylesheet to every page.

jQuery on every page. The theme, and a pile of small scripts written over the years, depended on jQuery. So every page loaded the library, then the plugins built on it, then the code built on those. A shopper opening a product page on a mid-range phone was paying for the cart drawer, the collection filters and the size guide, all at once, before they could tap Add to cart.

None of this shows up in a screenshot of the store. The design was fine. The weight was in code nobody could see.

Why we didn’t redesign

A redesign would have fixed the architecture, but it would have also changed everything the brand’s customers already knew how to use. It’s months of work, a big launch, and a lot of risk concentrated on one day.

The problem wasn’t how the store looked. It was what the store loaded. So we kept the look and replaced what was underneath it, piece by piece.

How we rebuilt it

1. Measure first, then pick the slowest section

Before touching code, we looked at two sources:

  • Shopify’s web performance dashboard (in Analytics), which shows real visitor data for Core Web Vitals: how fast the main content appears (LCP), how fast the page responds to taps (INP), and how much it jumps around while loading (CLS).
  • PageSpeed Insights on mobile, for a lab view of a single page and a list of what’s blocking it.

The product page was the priority. It’s where shoppers decide, and it’s where most traffic lands from ads. We started there and worked outward.

2. Move to Online Store 2.0, one section at a time

Online Store 2.0 uses JSON templates, which means every page is built from sections, and every section is its own file with its own markup, settings and scripts.

That’s the real win for speed. Once a feature lives in its own section, its JavaScript can load only on the pages that use it:

{%- comment -%} sections/main-product.liquid {%- endcomment -%}
<script src="{{ 'product-form.min.js' | asset_url }}" defer></script>

One detail worth knowing: we didn’t use the {% javascript %} tag inside sections for this. Shopify concatenates everything in those tags into a single file and injects it on every page, which is the opposite of what you want here. A plain script tag with defer, inside the section, keeps the code scoped to the page that needs it.

We migrated section by section. Each release swapped one piece, the store kept working, and nobody had to freeze anything for a big launch.

3. Replace jQuery with lighter code

As each section moved over, we rewrote its behavior without jQuery, using Alpine.js for the interactive parts. Alpine is small and declarative, so behavior lives right next to the markup it controls.

A typical before and after, a size guide toggle:

// Before: jQuery, loaded on every page
$('.js-size-guide-toggle').on('click', function () {
  $(this).next('.js-size-guide').slideToggle();
});
<!-- After: Alpine, scoped to the section -->
<div x-data="{ open: false }">
  <button type="button" @click="open = !open" :aria-expanded="open">
    Size guide
  </button>
  <div x-show="open" x-transition>
    <!-- size table -->
  </div>
</div>

The library swap alone isn’t the whole story. The bigger gain came from deleting the plugins and old scripts that only existed because jQuery was already there. Once the last section stopped needing jQuery, it stopped loading on every page.

A nice side effect: the Alpine version is easier to make accessible, because state like aria-expanded sits in the markup where you can see it.

4. Add a build step that shrinks every file

The old theme shipped its JavaScript and CSS exactly as written: comments, whitespace, long variable names, unused code. We added Vite as a build step. Source files live outside the theme, and Vite bundles, minifies and drops unused code before writing the final files into the theme’s assets folder.

A minimal version of the setup:

// vite.config.js
import { defineConfig } from 'vite';

export default defineConfig({
  build: {
    outDir: 'assets',
    assetsDir: '',
    emptyOutDir: false,
    rollupOptions: {
      input: {
        'product-form': 'src/js/product-form.js',
        'cart-drawer': 'src/js/cart-drawer.js',
      },
      output: {
        entryFileNames: '[name].min.js',
        chunkFileNames: '[name].min.js',
        assetFileNames: '[name][extname]',
      },
    },
  },
});

Each entry becomes one small file that a single section loads. Shoppers download less, and the store looks exactly the same.

5. Ship small, check, repeat

Every section went out on its own, and after each release we checked the numbers again. That rhythm is what made the project possible alongside normal work. There was never a moment where the whole store was in pieces.

The result

  • Load time went from about 3.5 seconds to about 2.
  • Shopify’s performance dashboard went from yellow and red to green.
  • The store looks the same. No redesign, no big launch day.

What I’d tell any merchant

Speed isn’t one project. It’s your slowest section, then the next one. You don’t need to touch code to find out where you stand:

  1. Open your best selling product page on your phone with wifi off. Count the seconds until you can tap Add to cart. If you waited, so do your shoppers.
  2. Check the web performance dashboard in Shopify Analytics. If it’s yellow or red, the problem is real and measurable.
  3. Ask whoever works on your theme four questions:
    • Is the theme on Online Store 2.0, with JSON templates?
    • Does it still load jQuery?
    • Is there a build step that minifies our JavaScript and CSS?
    • What loads on every page, and does it need to?

If the answers are “no, yes, no, a lot”, you don’t need a redesign. You need a plan to rebuild one section at a time.


I write up one real Shopify build like this every week, with the how included. Get the weekly note.

And if you want to see how much your product images are slowing your store down, run your product page through the free image speed check.