How do you remove unused code from your Shopify theme?

by Alfredo Pantoja

I found that after uninstalling a Shopify app, the theme will have a lot of unused code, affecting the speed of the page. Are there any apps that can clear all unused code from my Shopify theme?

Unfortunately, there aren't any Shopify apps that will automatically remove unused code from other apps.

However, here is a process you can follow to remove this code.

Contact the app developer

You should first contact the app developer. Many times they'll remove it for you with the hope that you'll leave them a good review. This is your best option.

Other times they'll point you to documentation on a step-by-step process to remove their app's code.

This is how you can contact any app's developer:

  1. Go to the "Apps" section of your admin dashboard.
  2. A modal will appear with all of your installed apps. Scroll all the way to the bottom of the modal and click on "App and sales channel setting".
  3. Click on the app you would like to contact.
  4. On the top menu click on "Get support". Sometimes this link will be inside of a "More actions" dropdown.
  5. Let them know you wish to remove their app and any unnecessary code installed by their app.

Search for their code inside of your theme

If the app's developer won't remove it for you, and they don't provide you with specific documentation for doing it on your own, you can search for the app's code and remove it yourself.

For example, if the app's name is "ACME", you would search for all instances of "ACME" inside of your theme.

You should only touch the code if you feel comfortable doing so. Make sure to create a theme backup before making any changes to the code of your theme.

More than likely, you would want to hire a developer to do this for you.

In Conclusion

Following this process whenever you uninstall an app, will ensure that your theme stays light and fast.

And next time think twice before installing another app. Ask yourself, do you really need it?