Where to place custom JavaScript?

Before posting I searched for similar posts and the answers were vague. For example one person giving multiple solutions such as index.tpl and more. I only need one solution.
I have created a feature that displays the dispatch time based on time of day and working hours. This will be displayed on the product page.
The html that will call this javascript will be placed somewhere on the products page.
I need help with the exact path and file folder to add this javascript either as a .js file or by pasting the actual content.

Many thanks.

Update: Problem resolved. Since I dont need to reuse the script on more pages there is no need to add it as an external script. So i added it together with the html (on top) and it seems to be working just fine.

2 Likes

You can also use the following solution to add custom .js files

2 Likes

Also please check the following article:
https://docs.cs-cart.com/latest/user_guide/look_and_feel/changing_attributes/add_custom_js_code.html

2 Likes

Thank you guys for your helpful tips.

2 Likes

This topic was automatically closed 6 hours after the last reply. New replies are no longer allowed.