how do I add javascript code to an individual page

Highlighted
New Member
6 0 0

Hi

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

is it possible to do this?

thanks katie

0 Likes
Highlighted
Shopify Staff
Shopify Staff
705 43 118

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

2 Likes
Highlighted
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?

0 Likes
Highlighted
New Member
1 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?

 

0 Likes