跪拜 Guibai
← All articles
Frontend · JavaScript · Programmer

jQuery in 2026: The Case for Keeping It on Server-Rendered Shopify Pages

By ErpanOmer ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

The React-everywhere reflex has a real cost on server-rendered e-commerce pages: several hundred kilobytes of JavaScript, duplicated rendering logic, and a build pipeline that locks out non-developer maintainers. This case shows a server-rendered theme can hit sub-150ms INP and faster LCP with 6KB of jQuery, a concrete alternative for teams who need cheap maintenance over framework purity.

Summary

A Shopify theme redesign for a product detail page—variant switching, add-to-cart, cart drawer, stock hints—leans on jQuery rather than React. The author details the decision after a colleague's skeptical meme. The page is fully server-rendered via Liquid templates, so the frontend only enhances existing HTML. A React island approach would add ~120KB of JavaScript, which hurts LCP and INP for a mobile-heavy audience in Southeast Asia and the Middle East. It also forces client-side re-rendering of already-rendered variants, duplicating price and locale logic. Maintenance falls to operations staff and an outsourced developer who edit files directly in Shopify's code editor with no build process; introducing React would require rebuilding and redeploying for every change.

Instead of native JS, the author picks jQuery because 4 out of 7 installed Shopify Apps already inject it. The page carries a jQuery copy anyway, making native utilities redundant. The provided code shows modern patterns: namespaced events, cleanup handlers for Shopify section reloads, aborting in-flight add-to-cart requests, and using .text() instead of .html() to prevent XSS. The total interaction code compresses to about 6KB, and launch metrics show mobile LCP improved by 0.6 seconds with INP under 150ms.

The article also covers pitfalls: version conflicts handled via noConflict(true) with a private reference, and the rule that jQuery only fits low-complexity interactions. When state balloons into multi-step forms or real-time previews, the author advises switching to React or Vue for that specific block. The closing line: choose technology based on page shape, team, and performance budget, not release year.

Takeaways
— A Shopify product page's server-rendered Liquid HTML needs only enhancement for variant switching and cart; no client-side rendering is required.
— Adding React (react + react-dom) to the page introduces roughly 120KB of compressed JavaScript, worsening LCP and INP for mobile users in Southeast Asia and the Middle East.
— Double rendering means price formatting, multi-currency, and multi-language logic must be written in both Liquid and React, risking inconsistency when operators change theme blocks.
— Without a build process, operations staff and outsourced developers can edit jQuery files directly in Shopify's code editor; React would force every change through a build and deploy cycle.
— 4 of 7 installed Shopify Apps already inject jQuery into the page, so a native JS utility layer would duplicate what already exists.
— The author's jQuery code uses namespaced events, cleanup on section unload, aborts previous add-to-cart requests on rapid clicks, and uses .text() to avoid XSS from untrusted variant titles.
— Production results: interaction code compresses to about 6KB; mobile LCP improved by 0.6 seconds and INP stayed under 150ms after launch.
— jQuery version conflicts are handled with jquery-3.7.1.min.js loaded first, then jQuery.noConflict(true) assigned to a private window.ThemeJQ reference.
— jQuery fits interactions with little and short-lived state; complex scenarios with multi-step forms or real-time previews should still use React or Vue mounted on a single block.
Conclusions

The article's core argument is economic: the 120KB JavaScript payload and the maintenance lock-in of a build step outweigh any architectural elegance React offers for this page shape. The choice isn't about taste, it's about who maintains the code after launch.

Third-party app ecosystems, especially on Shopify, silently dictate frontend dependencies. When apps inject jQuery, the cost of avoiding it becomes higher than the cost of using it, regardless of native APIs being sufficient.

The pattern of using a fixed jQuery via noConflict(true) and a private reference is a pragmatic answer to the version mess that plagues plugin-heavy themes, yet it's rarely documented in modern frontend guides.

The author's distinction between pages needing enhancement versus pages needing rendering is a useful mental model that maps well to server-rendered content sites versus admin dashboards and editors.

Concepts & terms
LCP (Largest Contentful Paint)
A Core Web Vital metric measuring the time from page load to when the largest visible content element (like a product image) renders. Lower is better and it directly impacts SEO and ad quality scores.
INP (Interaction to Next Paint)
A Core Web Vital metric that measures the responsiveness of a page by tracking the longest delay between a user interaction (click, tap, keypress) and the next paint. Under 200ms is considered good.
noConflict(true)
A jQuery method that returns jQuery and restores the original values of $ and jQuery, allowing a page to hold a private reference to a specific version, protecting it from later overwrites by other scripts or plugins.
Shopify Section
A reusable, independently reloadable block in the Shopify theme editor. When a merchant changes block config, the section is reloaded via a JavaScript event, requiring proper cleanup of event listeners to avoid duplicates.
From the discussion

The legitimacy of keeping jQuery on Shopify pages is contested. Relying on existing dependencies reads as technical debt, and AI-driven coding weakens the 'operations are familiar with it' argument; the opposing view holds that Shopify's SSR is simple HTML-like output, making modern frameworks overkill. The article's own caveat—using React/Vue for complex interactions like multi-step flows and linked fields—is cited as a boundary. One sarcastic remark about the frontend being dead underscores the perceived staleness of the debate.

— Continuing with jQuery stems from dependency inertia, which is technical debt rather than a deliberate choice.
— AI code generation undermines the claim that non-technical staff's familiarity with jQuery justifies its use.
— Shopify's SSR is simple and HTML-like, so adding a heavy framework like React or Vue is unnecessary there.
— The article's admission that complex scenarios (multi-step, linked fields, undo/redo) warrant React/Vue in isolated sections shows jQuery has a limited applicability, not a universal mandate.
— A joke about the frontend being dead highlights how outdated the jQuery-vs-framework question feels to some.
Featured comments
无声2017 2 likes

After reading it, the core point is still that jQuery is being kept because there's already a dependency on it, right? I feel this is more like technical debt. As for outsourcing and operations being more familiar with it, now that AI writes code, I don't think that reason holds up either. Really, it comes down to what the project itself needs—I don't understand Shopify, so I won't comment on that.

ErpanOmer

Shopify's SSR rendering is HTML-like and not complex, so using a modern framework isn't appropriate.

无声2017  → ErpanOmer

I didn't say to use Vue/React or similar frameworks, but since you say it's not appropriate, then what about the passage in the article: 'But if the requirements become: multi-step product customization, real-time preview, dozens of linked fields, undo/redo—then using jQuery to manually sync the DOM will quickly spiral out of control. In that scenario, switch to React or Vue, and mount it only in that one section, without hesitation.' Was that said outside the context of Shopify? I thought it implied it could be used in Shopify.

虫洞空间 1 likes

The frontend is dead, and you're still asking if jQuery is dead.

ErpanOmer

[dejected][dejected]

See top comments, translated →
Source: juejin.cn ↗ Google Translate ↗ Backup ↗