You did the responsible thing: you audited your apps and uninstalled the ones you weren’t using. But your store didn’t get faster, and maybe a widget or popup is still showing up where the app used to be. What’s going on?
The answer is ghost code - the leftover scripts, snippets, and styles an app injected into your theme that didn’t get removed when you uninstalled it. It keeps loading on every page, quietly slowing your store and cluttering your theme. Here’s how to find it and remove it safely, without breaking your live store.
Why uninstalling doesn’t always remove the code
When you uninstall an app, Shopify revokes its access to your store’s data. But the files and code snippets the app wrote into your theme don’t automatically disappear with it. Whether they get cleaned up depends on how the app added them:
- Modern apps use Shopify’s Theme App Extensions (app embeds). Their code lives in a self-contained block that’s designed to go when you uninstall. Apps with the Built for Shopify badge are expected to work this way, which is a good reason to prefer them.
- Older apps (and some that inject directly into theme files) write their code straight into your
theme.liquid, snippets, and assets. Uninstalling the app leaves all of that behind.
So if your leftover-code problem comes from older apps or a legacy theme, you’ll likely have to clean it up by hand. It’s very doable - just follow these steps in order.
Step 0: Back up your theme first (don’t skip this)
Before you touch any code, make a copy you can fall back on. You have two good options:
- Duplicate the theme: go to Online Store > Themes, find your live theme, and click … > Duplicate. Make your edits on the duplicate, test it, and only publish once it’s clean.
- Use a backup app so you can restore your theme, and often the rest of your store, to an earlier version. See our best Shopify backup apps guide, and check that the plan you choose covers themes.
Editing theme code without a backup is how a small cleanup turns into a big outage. Thirty seconds of prep saves you that risk.
Step 1: Find the leftover code
In your (duplicated) theme, open Online Store > Themes > … > Edit code. Now hunt for references to apps you’ve removed:
- Check
theme.liquid(in the Layout folder) for<script>tags and stylesheet<link>s that mention an app’s name or load from its domain. - Scan the
snippetsfolder for files named after old apps, and search your templates for{% render %}or{% include %}lines that call them. - Look in
assetsfor leftover.jsand.cssfiles tied to removed apps.
The app’s name or domain is usually right there in the file name or the script URL, which makes matching code to app straightforward. A speed test that lists your slowest third-party scripts by domain is a fast way to build your hit list before you start digging.
Step 2: Check app embeds and Custom Liquid too
Not all app code lives in the code editor. Two commonly-missed spots:
- App embeds: in the theme editor, open Theme settings > App embeds. Toggles here belong to apps; a leftover one from a removed app can be switched off.
- Custom Liquid sections: some integrations were pasted into a Custom Liquid block on a page or in the theme customizer, not into the code files. Check your sections if a widget is still appearing.
Step 3: Remove it safely - the reference, not just the file
This is the part that trips people up. Remove the whole reference, not only the file it points to. If you delete a snippet file but leave the {% render 'old-app-snippet' %} line that calls it, Shopify will throw a Liquid error because it’s trying to load a file that no longer exists - and that can break the page.
So: delete the <script> tag, the stylesheet link, and the render/include line together. Change one thing at a time, and keep a note of what you removed in case you need to reverse it.
Step 4: For stubborn code, ask the developer
If you can’t tell what’s safe to remove, contact the app’s developer - they know what their app added and can tell you, or may do it for you. This is the safest route for anything you’re unsure about.
Step 5: Let a cleanup app find the leftovers
If you’d rather not comb through code manually, several Shopify apps scan your theme for leftover app code and flag it for you (the scans are read-only - they find, you decide). Searching the App Store for “theme cleaner” or “leftover code” turns up a few. They’re a good discovery aid, but still back up first and still test before publishing.
Step 6: Test before you publish
Once your duplicate theme is clean, preview it and click through the critical paths: homepage, a product page, the cart, and checkout. Confirm nothing is broken and nothing looks off. Only when it’s all working do you set the cleaned theme as your live one.
The payoff: a faster, cleaner store
Ghost code is one of the most common reasons a store stays slow even after you’ve trimmed your apps - so clearing it out is a direct speed win. If your store is sluggish and you’re not sure whether apps or leftover code are to blame, start with our guide on how to find which Shopify app is slowing down your store, then come back here to clean up what the uninstalled ones left behind. For the broader picture, our how to speed up your Shopify store guide covers the rest.
And to avoid the problem going forward: favor Built for Shopify apps, which are expected to use Theme App Extensions. Our guide on how to choose the right Shopify apps explains why that badge matters and what else to look for.
Quick recap
- Back up or duplicate your theme before editing anything.
- Find the leftover code in
theme.liquid, snippets, and assets - matched by app name or domain. - Check app embeds and Custom Liquid, not just the code editor.
- Remove the full reference (script tag + render line), not just the file.
- Ask the developer for anything you’re unsure about, and test every critical page before publishing.
Uninstalling an app is only half the job. Clearing out what it left behind is the other half - and now you know how to do it safely.
Frequently Asked Questions
Does uninstalling a Shopify app remove its code?
Often not. Uninstalling an app revokes its access to your store, but it does not always remove the code the app injected into your theme. Older apps in particular leave behind 'ghost code' - orphaned Liquid snippets, JavaScript, and CSS that keep loading on your storefront even though the app is gone. Apps built with Shopify's modern Theme App Extensions are designed to come out cleanly on uninstall, but many apps (and older installs) don't, which is why you often have to clean up manually.
Why is my store still slow after uninstalling apps?
Leftover app code is a common cause. When an app leaves scripts and stylesheets in your theme, the browser still downloads and runs them on every page load - so you keep paying the performance cost of an app you no longer use. Run a speed test and look at the third-party scripts loading on your page; if you spot a script from an app you've already removed, that's ghost code you need to clean out of your theme.
Is it safe to delete app code from my Shopify theme?
Yes, if you take two precautions. First, back up or duplicate your theme before editing so you can roll back instantly if something breaks. Second, remove the whole reference (for example the entire script tag or Liquid render line), not just the file it points to - an orphaned reference to a file that no longer exists can throw a Liquid error and break the page. After any change, preview your homepage, a product page, the cart, and checkout before publishing.
How do I know which code belongs to an app?
Look at the names and domains. App code is usually labeled - snippet files and script tags often include the app's name, and third-party scripts load from the app's own domain or CDN (for example a script from the app's domain). In your theme's code editor, search the layout and snippets for script tags and render/include lines that reference an app you've removed. A speed test that lists third-party scripts by domain also makes it easy to match a script to the app behind it.
Do all Shopify apps leave code behind when removed?
No. Apps that use Shopify's Theme App Extensions add their code through app blocks and embeds, which are designed to be removed when you uninstall. The apps that leave ghost code are typically older ones, or ones that injected code directly into your theme files. Choosing apps that use Theme App Extensions is a good way to avoid this problem. Built for Shopify apps are expected to use them.