How to remove leftover Shopify app code safely: preview a theme copy before you publish
Updated November 14, 2026
Short answer: never remove app code from your live theme. Duplicate the theme, remove the code in the copy, and preview the copy on your homepage, a product page, a collection page and the cart with the browser console open. When everything looks and works the same, publish the copy. Your old theme moves to your unpublished themes, so you can publish it again if something turns up later.
Want it done for you? GhostCode finds leftover app code and can remove it in a copy of your theme. You preview it and publish it yourself. Your live theme is never changed. Free and paid plans available.
Why work on a copy
Edits in the code editor save straight to the theme you are editing. If that theme is live, a mistake shows up for shoppers the moment you save, and a theme file you delete can't be recovered. A copy gives you a place to make every change, check it, and throw it away if it goes wrong. Shoppers see none of it until you publish.
This guide covers the safe routine around the removal. For where leftover code hides and how to search for it, see how to find and remove leftover code from uninstalled Shopify apps.
Step by step
- Duplicate your live theme. In your Shopify admin, go to Online Store → Themes. Open the actions menu (…) on your current theme and choose Duplicate. The copy appears in your list of unpublished themes, named "Copy of" followed by your theme's name.
- Remove the code in the copy. Open the copy's actions menu (…) and choose Edit code. Search for each uninstalled app's name and web address. Remove the line that loads the app's code before you delete any of its files, and leave anything you aren't sure about.
- Preview the copy. Open the copy's actions menu (…) and choose Preview. You see your store with the copy's code, and shoppers still see the live theme.
- Check the pages. In the preview, open your homepage, a product page, a collection page and the cart. Add a product to the cart. Try search and the menu. Check on a phone-sized window too. Look for blank spaces, missing widgets you still use, and Liquid errors in the page. Open the browser console (F12 → Console) on each page and look for red errors.
- Publish the copy. When the preview looks and works like your live store, publish the copy from the theme list. It replaces your live theme for every shopper.
- Keep the old theme as a fallback. Your previous theme moves to your unpublished themes with its changes kept. Leave it there for a few weeks. If a problem turns up, publish it again.
Keep the time between duplicating and publishing short. The copy is a snapshot. If you or an app change the live theme while you work on the copy, for example in the theme editor, those changes are not in the copy, and publishing the copy drops them. Make the copy just before you start, avoid editing the live theme in the meantime, and publish once your checks pass.
What can go wrong, and how preview catches it
A script that another script depends on
Some apps load a file with one tag, then run it with a second, inline script further down the page, for example a line that starts the app's widget with the app's own settings. Remove the first tag and keep the second, and the second script fails with an error such as AppName is not defined. The page usually still loads, so it's easy to miss by eye. The browser console shows it. Remove the app's inline script too, or put the first tag back.
An app that is still installed
Code that looks old can belong to an app you still use. Remove it and that app stops working on your storefront: reviews vanish, a badge disappears, a popup stops showing. Before you remove anything, check the app is gone from your installed apps in Settings → Apps, and check App embeds in the theme editor for an embed that is still switched on. In the preview, compare each page with your live store and look for anything missing.
A snippet that is still loaded somewhere
If you delete an app's snippet file while a render or include line elsewhere still points to it, the theme shows a Liquid error where the snippet used to appear. Preview shows that error on the page. Search the whole theme for the snippet's name and remove those lines before you delete the file, or leave the file in place.
Pages you didn't open
Preview only shows the pages you visit. Code that runs on one template, such as a blog post, a page with its own template or the customer account pages, can break without you seeing it on the homepage. If the code you removed was in one section or template, preview a page that uses it.
The faster way: GhostCode's Clean copy
The routine above is careful work. Most stores either pay a developer to do it or edit theme code themselves. Clean copy does the common removals for you, in a copy you preview before you publish.
We make GhostCode, a Shopify app that finds leftover code from uninstalled apps in your theme and shows which app each piece came from. Its optional Clean copy feature follows the routine above for you:
- It makes an unpublished copy of your published theme and removes, in that copy only, the leftover code you select: app script tags, app stylesheet tags, connection hints (preconnect, dns-prefetch and preload links) to app domains, and render or include lines for app snippets.
- It never edits or publishes your live theme. It doesn't delete theme files or edit theme settings or JSON files.
- Findings for an app that still has a live app embed are blocked, and you confirm each app is uninstalled before its code is removed.
- You preview the copy and publish it yourself in Shopify admin. The copy stays in your theme library until you delete it, and it counts toward Shopify's theme limit.
- GhostCode only reads your theme by default. Clean copy asks for Shopify's permission to edit themes the first time you use it.
The checks in this guide still apply to the copy it makes: preview it, open the console, and keep your old theme until you're sure. Read how GhostCode works. Free and paid plans available.
Common questions
Does previewing a Shopify theme change my live store?
No. Shoppers keep seeing your published theme while you preview a copy. Nothing changes for them until you publish the copy.
Can I go back to my old theme after I publish the copy?
Yes. When you publish a theme, the theme that was live before moves to your list of unpublished (draft) themes with its changes kept. If something is wrong, publish the old theme again.
How many theme copies can I keep in Shopify?
Shopify's Help Center says a store can have 20 themes. If you already have 20, you need to delete one before you can duplicate another. Deleting a theme is permanent, so download it first if you might need it.
Does GhostCode's Clean copy change my live theme?
No. Clean copy makes an unpublished copy of your published theme and removes the leftover code you select in that copy only. It never edits or publishes your live theme. You preview the copy and publish it yourself in Shopify admin.
Find your theme's leftover app code: install GhostCode from the Shopify App Store. It never changes your live theme. Free and paid plans available.
Related guides
- How to find and remove leftover code from uninstalled Shopify apps
- Does uninstalling a Shopify app remove its code from your theme?
- Shopify script tags stop working March 1, 2027: which apps on your store will break
Sources
- Shopify Help Center: Duplicating themes (copy name and the 20 theme limit)
- Shopify Help Center: Publishing themes (the previous theme moves to draft themes)
Questions: support@alpenglowsoftware.com