Best practice javascript/jquery

Topic summary

A new theme developer asks whether using jQuery in a Shopify theme (built from Dawn) is acceptable, given their familiarity with it and observations that Shopify’s checkout uses jQuery and product JSON endpoints exist.

Key guidance:

  • jQuery is not prohibited, but vanilla JS helps meet Theme Store performance/accessibility targets (Lighthouse), reduces unneeded code, and simplifies debugging.
  • Libraries often include unoptimized code that can degrade performance.
  • A shared case study shows significant gains from removing jQuery and rewriting in vanilla JS.

Alternatives discussed:

  • A lightweight jQuery-like library (Cash) is suggested to retain familiar syntax with a smaller footprint.
  • Concern raised that Cash may lack AJAX support.

Direction/outcome:

  • The developer acknowledges modern themes don’t need jQuery and leans toward writing vanilla JS, possibly creating a small custom “framework.”
  • No rule mandates plain JS, but best practice for Theme Store-quality themes trends toward vanilla JS for performance and maintainability.

Status: Effectively resolved with a plan to avoid jQuery and rely on vanilla JS; no remaining open questions.

Summarized with AI on January 6. AI used: gpt-5.

Hi,

I’m new to Shopify and in the near future I would like to create a theme for the theme store.

Currently I’m building a theme for a single webshop. For that I use theme Dawn as a starting point since it inlcudes best practices and all other important stuff.

Dawn is using vanilla Javascript. I’m more familiar with jQuery and work a lot faster with this library compared to plain Javascript. Shopify does not forbid the use of jQuery but also does not recommend it. I also read that the Shopify checkout is using jQuery and even saw that product data is available in JSON style like products/the-3p-fulfilled-snowboard?format=json. For me the use of jQuery would be a good idea then.

However I was wondering what you guys think is the best approach?!

All (or most I checked) themes in the theme store seem to use plain JS. So it looks to me it’s more or less mandatory to use plain JS for a theme to be released in the theme store?

Hi Meules,

You are not prohibited from using a JS library - but there are some benefits from relying on vanilla JS:

  • It’s easier to meet the performance requirements if the theme is not relying on a library which might have unnecessary JS
  • If merchants encounter bugs in your theme, it will be easier to troubleshoot problems if you’ve written the JS yourself
  • JS libraries will likely have unoptimised code, which again could negatively impact performance.

There’s a really great article here that a theme partner wrote on their experiences optimising and rewriting their theme / removing jQuery, which will likely answer a lot of your questions.

1 Like

Hi Liam,

Well that guy sounds a lot like me "Stuck in the past", probably we’re same age too :slightly_smiling_face:

Still I really don’t understand how people end up with 6000 lines of jQuery code. Anyway the rest of the article makes sense.

Probably creating my own “framework” is the way to go then.

Thanks for the heads up.

1 Like

You could explore more lightweight libraries like Cash - which would give to access to most of the benefits of jQuery but with a much smaller size.

Seems that is doesn’t support AJAX requests(??)

Anyway like the article said we don’t need libraries anymore so I should not want to use it.