Entering Script Code onto Page

ibumovement_183
Visitor
1 0 0

Hi there! I am trying to add "script coding" to our website theme from an outside website— we are a non-profit and the coding will provide a form that will live on our donation page. The outside website is called "Bloomerang" and they have tutorials for websites like "Wix" but not Shopify. I was hoping the community could help me input the code into our page template. Is it just as easy as copy and pasting? Thanks for your help!

Reply 1 (1)

Liam
Shopify Staff
2731 302 777

Hi Ibumovement_183,

 

The placement of the script you need to add will depend on the theme you're using - different themes can have different structures which would determine where you make changes to the code. For example if you're using Shopify's free Dawn theme, you'd be adding your code to the `main-page.liquid` file in the `/sections` directory

 

Where exactly in the file you want to place the code also depends on if it's a visible element and where you want it to be displayed. You mentioned it's script coding, so maybe it's a snippet of Javascript which means you'd add the code just above the opening `{% schema %}` tag, (see line 25 here) but inside a set of <script> tags. So using Dawn's page file as an example, this would look something like:

 

    {{ page.content }}
  </div>
</div>
<script>
  [Your script here]
</script>
{% schema %}

 

Also - keep in mind when you're making these changes to add them to an unpublished duplicate of your theme so you're not potentially disrupting a live store 🙂 Hope this helps!

Liam | Developer Advocate @ 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 Shopify.dev or the Shopify Web Design and Development Blog