Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi all,
Hope someone can help..
I need to install a pre-determined splash pop up banner and I have been given a JavaScript folder with a code but I am not sure if this can be done on Shopify. Has someone had the same issue?
Any help would be highly appreciated.
Thanks
Andrea
Hi there,
Jack from OpenThinking here!
1. You need to upload all the files that were given to you into the assets folder
2. After that you need to call these files into your layout/theme.liquid file (at the end just before the </body> tag), with the following code:
{{ 'nameOfFile.js' | asset_url | script_tag }}
{{ 'nameOfFile2.js' | asset_url | script_tag }}
let me know if this works for your. If yes; accept my answer and give me thumbs up! Thank you.
Hi Open Thinking,
Many thanks for taking the time to look at this. Apologies for my ignorance but where can I find the assets folder?
Thanks again,
Andrea
Online store > Themes > Actions > Edit code
Hi OpenThiking,
Many thanks again for taking the time to respond to me, I really appreciated.
Unfortunately, I can't get this to work it looks like I am required to actually transfer a folder rather than single files. Do you know if folders can be added to the Assets folder?
The below are the instructions that I was given by the MLM company I work for
I understand but that is not possible. Shopify has a pre-defined directory structure and additional directories cannot be created.
You've to upload those files in the assets folder and include them from there inside your theme.liquid file. You've to adapt the code to work with Shopify.
The "script" that was sent to you isn't made for Shopify, perhaps it was developed for some other system such as WordPress or other self-hosted alternatives.
Hi Ferrix,
I know it has been some years since this was asked, but I thought I would share my experience with this in case you still had issues or for anyone in the future.
You should have a file called "pop-up" within the original folder. You need to save this as a .txt file initially. Then you can open it up, change the [NAME OF MEMBER] and save the file as a .js.
You can then add this .js file to your "Assets" folders in shopify, then add the following snippet in your theme.liquid file just before the closing </body> tag:
<div id="herbalifepopup"></div>
{{ 'pop-up.js' | asset_url | script_tag }}
Hope this helps.
Regards,
Simon.
We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024The Hydrogen Visual Editor is now available to merchants in Shopify Editions | Summer '...
By JasonH Sep 2, 2024