Add js File in Magento – 7 Easy to Follow Steps

In Magento CMS the easiest and recommended way to add js file is by using custom codes. Apart from including a js file, you can add and implement hosted scripts and JavaScript libraries as well. Use the JavaScript editor in the Theme Customization section in Magento admin panel.

How to Add js File in Magento Easily?

Add js File in Magento using Custom Code

  1. In Magento, go Design > Themes Editor > Java Script Editor
  2. In the Admin panel, go to Design > Themes Editor
  3. Click ‘Customize’ for the theme in which the js file is to be added
  4. To manage JavaScript assets, click on ‘JavaScript Editor’
  5. Click Browse Files to add js file in Magento from your local drive.
  6. Select the file and press ‘Upload Files’
  7. Click ‘Save’ to save the changes made

This is the best way to add js file in Magento CMS. But remember the following points while uploading multiple JavaScript files.

  • Add all js files one by one and then upload them all at once.
  • Make sure that the order of execution of the js files is correct.

If you have added multiple js files from your computer, sort them using drag and drop.