How to Edit Shopify Theme Code (Without Breaking It)
How to edit Shopify theme code safely: duplicate your theme first, open the code editor, save and format changes, and know where the limits are.

To edit Shopify theme code, duplicate your theme as a backup, then open Online Store > your theme's menu > Edit code to reach the built-in code editor. From there you can browse the theme's Liquid, CSS, and JSON files, make a change, save it, and rely on Theme Check and the Timeline panel to catch mistakes or revert a single file if something breaks.
Duplicate your theme before you touch any code
Shopify's own documentation frames this as a caution, not a suggestion: if a code change you make is incompatible with a later theme update, all of your code changes are removed from the updated copy. The same page recommends editing a theme's code only if you can't make the change you need through a Shopify app or the theme editor, and only if you know HTML and CSS and have a basic understanding of Liquid.
Before you start, Shopify's documentation recommends duplicating your theme to create a backup copy, so that you can discard your changes and start again if something goes wrong. That backup matters more than it might seem, because of how limited the built-in undo tools actually are once you're inside a file.
The Timeline view, which tracks changes to Liquid files, restores one existing file at a time to an earlier version. It doesn't restore an entire theme, and it can't recover a file you've deleted. Timeline history is also finite, so an older version might not be available when you need it. A duplicated theme is the only safety net that covers the whole theme, not just one file at a time.
Where to edit Shopify theme code in your admin
On desktop, go to Online Store in your Shopify admin, find the theme you want to change, and choose Edit code from its menu. On the Shopify mobile app, go to Online Store, tap Manage themes, and tap Edit code from the same menu on the theme you want. Either path opens a directory of the theme's files next to an editing area, and you can open and edit more than one file at the same time.
To jump straight to a file, use Cmd+P on Mac or Ctrl+P on Windows and type the file name rather than clicking through the directory by hand. Once a file is open, it stays in its own tab, so you can switch between several open files while you work through a change.
Making, saving, and formatting a code change
A dot appears next to a file's tab name as soon as you have unsaved changes in it. Save with the Save button, or with Cmd+S on Mac and Ctrl+S on Windows. If your indentation gets messy, open the Command Palette with Cmd+Shift+P or Ctrl+Shift+P, type "format", and select Format document to clean it up automatically.
The code editor runs Theme Check in the background as you type, which is meant to surface mistakes before they reach your live theme rather than after. Inside the editor, Theme Check specifically flags parser-blocking scripts (script tags that can slow down your storefront), inconsistencies between translation files such as missing or mismatched keys across locale files, and templates referenced by your code that don't actually exist. Each of these shows up as a red underline, and hovering over the line reveals the error. Theme Check's published checks reference lists dozens of specific rules beyond these three, covering things like unused snippets, deprecated tags, and image tags missing width and height attributes — but the editor surfaces errors as you write, not a guarantee that every possible mistake is caught before you publish.
If the change you're making turns into something bigger than a quick fix — a new template, a custom app integration, or a redesign of a section — our Shopify theme development service can take it from there instead of you working through it solo in the code editor.
Searching, renaming, and deleting theme files safely
Within an open file, Cmd+F or Ctrl+F searches that file's code, with the option to replace one instance or all of them, including a Preserve case setting that matches the replacement's capitalization to what it's replacing. To search every file in the theme at once rather than just the open one, use the search button in the sidebar — results show every match and which file it's in, with the same replace options available.
You can add, rename, and delete files directly in the editor. New file names can only use letters, numbers, dashes, and underscores — no spaces — plus a period and an extension such as .liquid or .css. If you're adding new reusable snippet files as part of a change, it's worth knowing about Liquid's newer block and partial tags before you structure them, which we cover in our breakdown of Liquid's new block and partial tags, now in developer preview.
Deleting a file is permanent. There's no Timeline entry to bring back a file once it's gone, which is exactly the scenario the theme duplicate you made earlier is for — restore the deleted file from the backup copy rather than trying to recreate it from memory.
Where editing theme code hits a wall
Two limits catch people off guard. The first is a purchase requirement: you can only edit a theme's code after you've purchased it, and that includes using the AI code generator inside the theme editor. If you're trying out a paid theme before buying it, you need to complete the purchase first — there's no code access during a trial.
The second is how many themes your plan lets you keep in the admin at once. Stores on the Starter plan can only add the Spotlight theme. Stores on the Basic, Grow, and Advanced plans can add up to 20 themes total. If you're at your plan's limit and want to add another, you need to remove an existing theme first. Theme count isn't the only ceiling you can run into while building out a theme, either — section and block counts have their own limit, which we've covered separately in our piece on Shopify's theme block cap.
If you'd rather have a developer make the change for you, talk to our team.
Frequently asked questions
Do I need to know how to code to edit Shopify theme code?
Yes. Shopify's documentation recommends editing theme code only if you know HTML and CSS and have a basic understanding of Liquid, since theme files combine all three along with JSON. If you don't have that experience, Shopify suggests hiring a Shopify Partner for custom changes instead.
Can I edit a theme's code before I buy it?
No. You can only edit a theme's code after you've purchased it, and that requirement also covers the AI code generator in the theme editor. A theme you're previewing on a trial needs to be bought first.
Can the Timeline panel undo a mistake across my whole theme?
No, only one file at a time. The Timeline view restores a single existing file to an earlier version; it doesn't restore an entire theme, and it can't bring back a file you've deleted. That's why duplicating the theme before you start is the safety net for everything the Timeline can't cover.
What does Theme Check catch automatically while I'm editing?
Inside the code editor, Theme Check flags parser-blocking scripts, inconsistencies between translation files, and templates referenced in your code that don't exist, underlining each in red as you type. Its full checks reference covers many more rules, but the editor's live feedback isn't a guarantee that every possible error is caught before you publish.
How many themes can I keep in my Shopify admin?
It depends on your plan. The Starter plan can only add the Spotlight theme. The Basic, Grow, and Advanced plans can add up to 20 themes in total. If you've reached your plan's limit, you need to remove a theme before you can add another.