How Do I Remove Unused JavaScript From Shopify?

How Do I Remove Unused JavaScript From Shopify?

Removing unused JavaScript from your Shopify store can help improve your site's load time and overall performance. Here's a step-by-step guide to eliminating unused JavaScript from your Shopify store:

Step #1

Log in to your Shopify admin panel and click on "Online Store" on the left-hand side of the screen.

Step #2
Click on "Themes", and then select "Actions" and then "Edit Code" for the theme you want to work with.

how do i remove unused javascript from shopify

Step #3
Select the "Layout" folder in the code editor and then click on the "theme.liquid" file.

Step #4
Look for the code section that includes the "<script>" tags for your JavaScript files. This is typically located near the bottom of the file.

Step #5
Identify the JavaScript files that are not being used on your site. This can be done by looking at the file names or by using a tool like Google Chrome's Developer Tools to identify which scripts are not being loaded.

Step #6
Once you've identified the unused JavaScript files, you can remove the "<script>" tags that reference them.

Step #7
Save the changes to the "theme.liquid" file and refresh your site to ensure everything works properly.

If you're uncomfortable editing code directly, you can hire a Shopify developer from Ecomheroes or use a Shopify app to help you optimize your site's performance.

Pro Tip

If you want to boost store speed and conversion rate, then you can choose our Shopify store UX audit report task for just a price of a cup of coffee.

Complete Shopify Audit at Just $5 to Boost Conversions

Why should you remove unused JavaScript from your Shopify store?

When a browser loads a webpage, it must download all the resources associated with that page, including JavaScript files. If there are unnecessary JavaScript files on the page, this can increase the time it takes to load.


If you want to perform well in search result pages and boost your conversion rate, then optimizing your Shopify store loading speed is necessary. Eliminating unused JavaScript is one of the vital steps to improve Store performance.

Other Shopify related questions’ answers

How Do I Show Product Variants in Shopify?

You have multiple product variants to show on your Shopify store. Showing all product variants to your store will improve conversion rate, enhance brand credibility, and click through rate.

How Do I Verify My Shopify Domain on Facebook?

Verify Shopify domain on Facebook allows Shopify merchants to sell products to a large target audience, boosting store sales and increasing revenue. Leverage the power of social media to make your business successful.

How to Create Shopify Sub Collections?

Provide potential buyers better user experience with sub-collections if you want to make them buy your product hassle-free. You can categorize all the products based on gender, wearables, and occasion to make purchasing easy for users.

How to Set Up Shipping on Shopify?

Shipping cost depends on the product size and the delivery distance. It can’t be the same for all customers who purchase from your Shopify store. So, setting up different shipping rates is necessary to run a profitable business.

How to Upload HTML File to Shopify?

Want to add a section to your Shopify store with a custom HTML file? It is necessary to know how to upload the HTML file to the Shopify store to maintain the look and feel of the current store.

How to Add Background Color to Any Section on Shopify?

Your Shopify store should represent your business and what you are selling. To make your Shopify store intuitive, use the color scheme that best matches your product and logo and add a background color that suits your theme.

How to Hide a Certain Shopify Menu?

You have a Shopify store that has multi-category products. But after running a business for a few days, if you find that some of the product categories do not have sales or you don’t want to sell, then hide them from your Shopify menu.