Adding custom js file for site-wide functions

New Member
4 0 0

I am looking for a way to add to my existing theme custom JavaScript functions that can be used in all the site pages.

I see that I can add my custom-script.js.liquid file to the theme assets folder, and I can add `{{ 'braingames.js' | asset_url | script_tag }}` in the <head> section of my theme.liquid layout file. I can see that my script is loaded when the main page is opened, or product page is opened, or cart page is opened. However, my script is not loaded when I enter the checkout process. Is it because a different template is used there?

I see that there's a special feature available to add custom script to the Order Status page. I added this code `{{ 'braingames.js' | asset_url | script_tag }}` there, and this also resulted in successful loading of the file.

What are the limits, where a custom js file can be added, and where it is not possible?

52 1 56

It's impossible to do custom code in checkout page unless you have Shopify Plus