FROM CACHE - en_header

how do I add javascript code to an individual page

New Member
6 0 0


I want to add javascript code to one page only in my shopify store

is it possible to do this?

thanks katie

Replies 6 (6)
Shopify Staff
Shopify Staff
1092 99 193

Hi, Katie!

Elle here from Shopify's Social Care team. 

In order to add Javascript to a single page, you'll need to create a new page template under Online store > Themes > Actions > Edit Code. 

Here's how it will look: 

Once you've created the new template, look for the following snippet of code:

<div class="rte">

Paste your Javascript code above this line of code. Make sure to wrap it with <script> </script> tags.

Once you have this done, you can assign the new template to the page you'd like to apply it to here:

Hope this is helpful! 

Elle | Social Care @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

New Member
8 0 0

Do we have to copy the quick-add.js from the script/global/quick-add.js location to the assets folder?

New Member
2 0 0

I also want to add javascript code to an individual page and I tried to follow the instructions above but when I create the new page template, I don't see the piece of code referenced above:  

<div class="rte">

 I see a different piece of code that looks like this:   { % section "page" % }


Can you please advise?


Shopify Partner
63 1 26

To add JavaScript to an individual or group of Shopify pages:

  1. Go to your Shopify Admin and go to Online Store
  2. Click Actions > Edit Code
  3. Under your Templates folder, select Add a new template
  4. Choose the type of page you want the JavaScript to be added to. I will choose page as an example.
  5. Click Create template
  6. At the bottom of this file, include your JavaScript. Be sure to wrap it in <script></script> tags. I added a simple alert.
  7. Go to Page and Add or edit a page.
  8. In the page editor on the right-hand side, select the new template you just created.
  9. Test your page out! The JavaScript you wrote should be working.
  10. If you want this to apply to multiple pages, change the templates of the other pages you want the JavaScript to run on.

If you need additional help, check out the step-by-step screenshots on my blog post here.

New Member
1 0 1

I did this but I can't see the entire calculator that I'm trying to add?


It's supposed to look like this:






New Member
1 0 0

Is that the only way to add JS code to my shop...?

What would happen if I change the theme, would I have to create a new template again...?

Is there any way to make these steps theme-compatible...? I mean, compatible with any theme whatsoever...