Esely1945 Posted January 7 Share Posted January 7 Hi, New user here, I just installed Prestashop 8.2.0, I want to add simple javascript/jQuery code right before </body> ? What file should I edit? or should I do it via backend? Thank you. 1 Link to comment Share on other sites More sharing options...
Prestashop Addict Posted January 7 Share Posted January 7 Hi, it depends if you use js CCC or not, and the theme used. Link to comment Share on other sites More sharing options...
Andrei H Posted January 7 Share Posted January 7 Hello, PrestaShop automatically loads a custom.js file if it exists in the themes/<theme>/assets/js/ directory as you can see here You just need to create the file and add your custom code in there. Then clear the browser cache and the changes should be visible. Link to comment Share on other sites More sharing options...
Caroline Harper Posted January 14 Share Posted January 14 On 1/7/2026 at 2:42 PM, Esely1945 said: Hi, New user here, I just installed Prestashop 8.2.0, I want to add simple javascript/jQuery code right before </body> ? What file should I edit? or should I do it via backend? Thank you. Hi, You generally should not edit core PrestaShop files to add JavaScript. The recommended way depends on how permanent and reusable your code is. Recommended approach (safe and update-friendly) Option 1: Use the theme footer template (simple scripts) If you just need to add a small script before </body>: Edit /themes/your-theme/templates/_partials/footer.tpl Add your JavaScript at the end of the file. This is safe and won’t be overwritten by core updates (only theme changes). Best practice (cleanest solution) Option 2: Create a small custom module Register your JS using hookHeader (position = bottom) or hookDisplayFooter This keeps your changes upgrade-safe and independent of the theme This is the preferred solution if the script is reusable or you plan to maintain it long-term. What to avoid ❌ Editing core files in /classes, /controllers, or /themes/core ❌ Injecting JS directly into backend templates Summary Quick test or small script → footer.tpl Long-term or reusable logic → custom module If you want, I can share a step-by-step mini module example to inject JavaScript properly in PrestaShop 8.x. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now