How to remove leftover code from uninstalled apps in your Shopify theme

✍️ Mindaugas Bružas4 min readShopifyTheme CleanupUninstalled AppsLeftover CodePage Speedtheme.liquidThemeMedicShopify AppsCore Web Vitals
How to remove leftover code from uninstalled apps in your Shopify theme

Every Shopify store that has been running for a year or two has the same problem: the theme is full of code from apps that are no longer installed. A review widget from 2023, a popup app you tried for a week, a currency converter that was replaced by Shopify Markets. The apps are gone. Their scripts are still loading on every page.

This happens because of how older apps were built. Before theme app extensions, an app had to write its code directly into theme.liquid, product.liquid or a snippet. Uninstalling the app revokes its API access, but Shopify does not let it edit your theme afterwards, so the code stays. Some of it still downloads a script from a domain that no longer answers. Some of it references a snippet that was deleted and throws a Liquid error you never see.

What leftover code costs you

  • Speed. Each leftover script is a request, often to a slow or dead host. Three or four of them add seconds on mobile and drag down PageSpeed Insights.
  • Broken layout. A leftover CSS file can override your current theme's styles in ways you cannot trace.
  • Errors. {% render 'app-snippet' %} where the snippet no longer exists is a silent failure that can break the section around it.
  • Security. A script tag pointing at an abandoned domain is a script tag someone else could register.

How to find it manually

Open the theme code editor and search across files for the usual suspects:

  1. <script tags in theme.liquid whose src points to a domain you do not recognise.
  2. {% render %} and {% include %} lines whose snippet does not exist in the snippets folder.
  3. Snippets in the snippets folder that no file references.
  4. Comments like <!-- BEGIN app block --> or {% comment %} Added by ... {% endcomment %} with the name of an app you removed.
  5. Blocks inside product.liquid / main-product.liquid that mention app names.

Then test each one by opening the URL in a browser (dead host = safe to remove) and searching the theme for every reference before deleting a snippet. Always duplicate the theme first and work on the copy.

It is a couple of hours of careful work for a medium theme, and it is easy to delete something that is still needed.

The safer way: scan, review, back up, remove

We built ThemeMedic to do the boring part. It reads the theme files (read-only) and looks for:

  • known signatures of several hundred Shopify apps,
  • script and style tags whose file or host no longer responds,
  • render/include calls to snippets that do not exist,
  • snippets nothing references.

Every finding names the file, the line, what the code appears to be, and which app most likely added it. Code from apps that are still installed is marked as informational and cannot be removed by accident.

Cleanup requires explicit confirmation per finding, nothing is selected for you. Before any change, a full theme backup is taken and can be restored in one click. The recommended mode cleans a duplicated draft theme and leaves the live storefront untouched until you publish it, so you can compare the two.

Scanning is free forever. Pro (7.99 USD per month or 59 USD per year) adds cleanup, backups, restore and a weekly monitor that emails you when a new leftover appears. Details in the ThemeMedic documentation.

When to run a cleanup

  • Before a big campaign, so the store is as fast as it can be.
  • After uninstalling any app that was installed before 2022 (pre theme-app-extension era).
  • When PageSpeed Insights shows scripts from domains you do not recognise.
  • When switching themes: leftover code often gets copied over during migration.

Frequently asked questions

Can removing leftover code break my store? It can if you delete something still in use. That is why ThemeMedic marks code from installed apps as untouchable, takes a backup before every change, and prefers cleaning a draft copy of the theme.

Does this apply to theme app extensions? No. Apps built as theme app extensions (all our apps, and most modern ones) leave nothing behind on uninstall. The problem is older apps that wrote into theme files.

How much faster will the store be? It depends on what is left behind. Removing three dead scripts on a typical Dawn-based theme has saved merchants 0.5–2 seconds of load time on mobile in our tests. The bigger win is often the broken CSS overrides.

Is the scan safe? Yes. Scanning only reads theme files. Nothing is changed until you confirm each item.


ThemeMedic is built by MB „Liūto media" in Lithuania. All our Shopify apps are listed at liutoapps.com.

MB
Mindaugas Bružas

Founder of MB „Liūto media“ — building six focused Shopify apps: estimated delivery dates, shipping bars, product badges, email deliverability, theme cleanup and reorder reminders.

Built by the team behind six Shopify apps. See what we make →