Website Building » Shopify » How Do I Remove Unused JavaScript From Shopify?

How Do I Remove Unused JavaScript From Shopify?

Last updated on December 11, 2022 @ 11:31 am

When you create a new Shopify store, there is a lot of default JavaScript that gets added to your store. This JavaScript can slow down your store, and it can be difficult to remove it without breaking your store. In this article, we will show you how to remove unused JavaScript from your Shopify store.

There are two ways to remove unused JavaScript from your Shopify store: using the Shopify Admin or by editing your theme code.

Using the Shopify Admin

You can remove unused JavaScript from your Shopify store by going to the “Edit HTML/CSS” page in the Shopify admin.

Edit theme code shopify

On this page, you will see a list of all the files in your theme. Find the file called “theme.js” and click on it. In the “theme.js” file, you will see a lot of code. At the top of the file, there is a section called “ShopifyFD.”

Delete theme.js code shopify

This section contains all of the default JavaScript that gets added to your store. To remove this JavaScript, delete everything in this section.

PRO TIP: If you are not comfortable working with code, we recommend contacting a Shopify Expert. Making changes to your theme’s code can result in your site looking broken or, in some cases, not working at all.

Be careful when deleting code from your theme files. If you delete too much, you could break your store. If you are not sure what to delete, we recommend that you contact a developer for help.

Editing Your Theme Code

If you want to remove unused JavaScript from your Shopify store without going through the Shopify admin, you can edit your theme code directly. To do this, you will need to access your theme files using SFTP or the File Manager app.

Simply download the theme file and open it in your file manager.

Download theme file shopify

Once you have access to your theme files, open the “theme.js” file and delete the “ShopifyFD” section at the top of the file. Again, be careful when editing code, as too much can break your store. If you are not sure what to do, we recommend contacting a developer for help.

How Do I Remove Unused JavaScript From Shopify?

There are two ways to remove unused JavaScript from your Shopify store: using the Shopify Admin or editing your theme code directly.

Using the Shopify Admin is easy and only requires the deletion of code in one file – “theme.js,” which is located under “Edit HTML/CSS” on the Shopify Admin page. If you want to edit your theme code directly, you will need access to your theme files using SFTP or File Manager App and make changes in the same “theme.js” file by deleting the “ShopifyFD” section at the top of the file.

Morgan Bash

Morgan Bash

Technology enthusiast and Co-Founder of Women Coders SF.