A Theme Update Removed My Custom Code — How to Get It Back

Recover custom code, CSS, or sections a Shopify theme update replaced: restore from a duplicate, an older theme version, an export, or Git — step by step.

4 min readUpdated

Part of our guide to Update Your Shopify Theme Without Losing Customizations.

If a theme update just wiped a custom section, some CSS, or a script you had working, here is the reassuring part: your theme-editor settings are almost certainly still fine, and the missing piece is the code that was in your theme files. An update installs a fresh copy of the theme, so hand-edited files are replaced. This guide walks through getting that code back, in order of easiest to hardest.

It sits under Update your Shopify theme without losing customizations. If you have not updated yet, the backup routine prevents this entirely — but if the update already happened, keep reading.

First: confirm what is actually gone

Before you rebuild anything, figure out whether the code was lost or just the rendering broke. Open Online Store → Themes → ⋯ → Edit code on the updated theme and check for the specific file — for example sections/feature-banner.liquid or your assets/custom.css. If the file is missing or reverted to the theme's stock version, the update replaced it. Your editor settings (the text and images you typed) are stored separately and usually still there, waiting for the code to return.

Knowing which side you lost tells you what to restore. For a refresher on what an update replaces versus keeps, see does a theme update delete your customizations.

Option 1 — Restore from a duplicate you made

If you duplicated the theme before updating, this is a two-minute fix. Go to Themes, find your backup copy (for example Dawn — backup 2026-07-05), open its menu, and either Preview it to grab the code or Publish it to restore your pre-update state wholesale. Most often you will just open the backup's Edit code, copy the custom file's contents, and paste them into the updated theme.

No backup duplicate? Move to the next option.

Option 2 — Recover the older theme version from your library

Even without a manual duplicate, the pre-update theme may still exist in your theme library. When you update, the older version does not always vanish immediately — check Themes for an unpublished copy of the theme at its previous version. If it is there, open its Edit code, find your custom file, and copy the contents into the current theme. Do this promptly; do not delete old theme versions until you have confirmed everything is restored.

Option 3 — Recover from an exported .zip

If you exported the theme (⋯ → Export) at any point, that .zip contains the full file tree as it was, including your customizations. Unzip it locally and open the relevant file:

unzip theme-backup.zip -d theme-backup
# Your custom section:
cat theme-backup/sections/feature-banner.liquid
# Your custom styles:
cat theme-backup/assets/custom.css

Copy the contents into the corresponding file in the updated theme's code editor. If a file did not exist in the stock theme (a new section or snippet you added), recreate it with Add a new section / Add a new snippet and paste your code in.

Option 4 — Recover from Git

If you kept the theme under version control with the Shopify CLI, your customizations are in history and nothing is truly lost. Find the commit from before the update and pull the files you need:

# See the file as it was before the update commit
git log --oneline -- sections/feature-banner.liquid
git show <commit>:sections/feature-banner.liquid > sections/feature-banner.liquid

# Then push the restored files to the updated theme
shopify theme push --theme <updated-theme-id> --only sections/feature-banner.liquid

Re-push only the files you intend to restore so you do not overwrite anything the update legitimately changed.

Option 5 — Rebuild from the live site

If none of the above exist, you can still reconstruct code from what was published. The rendered HTML and CSS of your old section are visible in the browser's developer tools if you have a cached copy, an archived page, or a staging store on the old theme. It is slower, but the markup and styles are recoverable by inspecting the output and rebuilding the section file. If you rebuild, follow how to create a custom section so the new version is clean and configurable.

Stop this from happening again

Once your code is back, put a real safety net in place so the next update is a non-event:

  • Duplicate and export before every update, and keep a written list of your custom files. The full routine is in back up your theme customizations before updating.
  • Move sections you depend on out of theme files. A section rendered by an app through a Theme App Extension is not a theme file, so no update can replace it. That is the model SectionGuard uses — the section and its settings survive every update, with nothing to restore afterward.

The recovery options above get today's code back. The two habits above mean you will not need them next time.