Key takeaways
- Uninstalling a Shopify app does not automatically remove the code it added to your theme.
- Leftover code slows your store down with scripts loading for services that no longer exist.
- Find leftover code by searching for the app name in your theme’s code editor.
- Always work on a duplicate theme. Never edit your live theme directly.
Every time you install a Shopify app that modifies your theme, it leaves its fingerprints behind. When you uninstall the app, Shopify removes the app itself — but the code it added to your theme stays. Over time, as you cycle through apps, this cruft accumulates. Scripts load for services you no longer use. CSS classes reference styles from apps that haven’t existed for years.
This cleanup is one of the most underrated Shopify performance improvements.
How do I delete code in Shopify?
The short answer: Online Store → Themes → Actions → Edit code. This opens the code editor where you can view and edit all theme files. Deleting code requires knowing what’s safe to remove — the steps below help you identify it.
Step 1 — Duplicate your theme before touching anything
This is mandatory. Go to Online Store → Themes → find your active theme → click the three-dot menu → Duplicate.
A mistake in the wrong file breaks your entire storefront. Working on a duplicate means you can always revert by switching back to the original.
Step 2 — Search for the app name in your theme code
Open the code editor (Online Store → Themes → Actions → Edit code).
Most code editors have a search function. In Shopify’s editor, use the search bar at the top to find the app’s name. Try:
- The app’s brand name (e.g., “loox”, “klaviyo”, “privy”, “yotpo”)
- Common app identifier patterns (
app-name-snippets,app-name-scripts)
Where to look:
theme.liquid — the most common location for leftover script tags. Apps often add JavaScript includes to the <head> or before </body>. Look for <script src="https://app-name.com/..."> tags that remain after uninstallation.
snippets/ folder — apps often create new snippet files (e.g., loox-reviews.liquid, privy-popup.liquid). These appear as new files in the snippets folder that weren’t there before the app was installed.
sections/ folder — some apps add new section types. After uninstalling, the section file remains but the app functionality is broken.
assets/ folder — apps sometimes add CSS or JavaScript files here.
Step 3 — Identify what’s safe to remove
Not all “leftover” code is harmful. Some apps add features you continue to use via the rendered HTML even after the app is uninstalled (this is unusual but possible). Check each piece of code before deleting.
Safe to remove if:
- The code references external scripts (URLs) from the app’s domain that no longer load
- The files are named clearly after the uninstalled app
- Removing the code from theme.liquid doesn’t affect anything visible on the storefront (test on your duplicate)
Be cautious with:
- Generic snippet names that could have been created by multiple apps or your developer
- Any code that appears in sections still actively used on your storefront
Step 4 — Remove the code
For script tags in theme.liquid: delete the entire <script> tag (including the opening and closing tags).
For snippet files: click the file → delete from the three-dot menu next to the filename.
For section files created by an app: only delete if the section is no longer used in any templates or active pages.
After each deletion, preview your storefront to confirm nothing breaks.
Common apps that leave significant code behind
Popup and email capture apps (Privy, Sumo, Justuno) — often add large JavaScript files to theme.liquid.
Review apps (Yotpo, Loox, Judge.me) — add snippet files and often render code in product templates.
Chat apps (Gorgias, Tidio, Intercom) — add chat widget script tags to theme.liquid.
Social proof apps — add notification popups via scripts in theme.liquid.
Page builder apps (uninstalled PageFly, Shogun, GemPages) — can leave substantial section and snippet files behind.
Using Shopify’s App Embed system to prevent future leftover code
Modern Shopify apps use the App Embeds system (Online Store → Themes → Customize → App Embeds icon). When an app uses App Embeds properly:
- Enabling/disabling the app is done through a toggle in the Theme Editor
- Uninstalling the app removes the embed automatically
- No manual code cleanup needed
When choosing new apps, prefer those that use App Embeds over apps that ask you to paste code into theme.liquid. You can check this in the app’s installation instructions.
Using Theme Inspector to find slow scripts
The Shopify Theme Inspector Chrome extension shows which scripts and assets are contributing most to page load time. After cleaning up leftover code, run it to confirm the scripts are no longer loading.