Hello Shopify community,
I’m currently in the process of developing my own theme and have a question regarding the use of jQuery. Is it possible to incorporate jQuery into Shopify themes instead of using vanilla JavaScript? I’m curious about any potential constraints or limitations associated with using jQuery in this context.
Your insights and advice would be greatly appreciated!
Thank you
1 Like
Hello @Hussnain_dev ,
Yes, you can use jQuery in Shopify Themes. You need to add the jQuery CDN to the “theme.liquid” file before the tag.
1 Like
@Huptech-Web
Thanks Rishi
I am also concerned about Is there any constraints, limitations or any impact associated with using jQuery by Shopify.
Hello @Hussnain_dev ,
No, There will be no constraints, limitations, or impact using jQuery by Shopify.
Hi @Hussnain_dev
I understand about your concern. But it depends on your visitors and Business size. If your business is a newborn, you should satisfied jQuery because it’s cheap.
If your business is expanding and you are concerned about your store performance. You should go to Vanilla Javascript.
Read this article - https://www.shopify.com/partners/blog/28500611-using-javascript-to-super-power-your-clients-shopify-site
If you have any kind of problem in your Shopify store. You can say it freely.
Best regards
Shishir Hasan | Shopify Website Developer
No limitation in theme policy by shopify.
The ecosystem reality is you should avoid it as merchants, customizations, and apps may also add versions of jquery to a theme for use; and it encourages bloat.
By adding jquery as a theme dependency you are increasing the likelihood of incompatibility issues.
jQuery, frameworks, et al encourage a type of kitchen sink bloat where because something seems easy to implement the theme code or features bloat, whereas vanilla js forces you to make sane rational decisions respecting theme performance and size.
See the dawn theme js and web components model as a reference
1 Like