Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Hi, I'm looking to be able to customize a Policy Page. This includes the ability to add some Javascript or even a Web Component to the policy page.
I've gone to the policy settings and edited the HTML for a policy to include a `script` tag or a web component, but they get stripped out. I also don't see a way to make changes to these pages from the "Edit Code" part of my theme.
I've landed on including the script in my Footer and then adding logic to ensure it only runs on policy pages, but this is not an ideal or straightforward solution. Are there any other options?
I searched for other answers first, but it looks like previous threads aren't having any luck on this topic:
https://community.shopify.com/c/technical-q-a/how-can-i-insert-script-into-a-policy-page-on-my-ecomm...
HI @Mikael,
Please follow the instructions below
!. From you Admin page, go to Online Store > Themes
2. Select the theme you want to edit, click the three dots to edit code
3. Under the Layout folder, open the theme.liquid
4. Place this code below inside the <body> tag. Use the code below to inject your code your script.
{% if request.path contains "policies" %}
<script>alert("hello")</script>
{% endif %}