To change a live Shopify store safely, build in a development store, keep the theme in Git, push with Shopify CLI, and check each change on an unpublished preview theme before you publish it. Editing the live theme in the admin’s code editor works until something breaks in front of customers.
1. Deploy themes with Shopify CLI
Use Shopify CLI rather than editing code in the admin:
shopify theme dev # local preview with hot reload
shopify theme push # upload to a theme
Keep store and theme details in a shopify.theme.toml file, one environment per target:
[environments.staging]
store = "my-store"
theme = "123456789012"
[environments.production]
store = "my-store"
theme = "123456789099"
Then choose the target explicitly:
shopify theme push --environment staging
Keep passwords and Theme Access tokens out of this file and out of Git. In CI, pass them as secrets through environment variables such as SHOPIFY_CLI_THEME_TOKEN.
2. Work in a development store
Don’t build on the live store. Instead:
- Build against a development store or an unpublished copy of the live theme
- Use realistic test products, including the awkward ones: long titles, many variants, no image
- Keep the theme code in Git and use the CLI to move it between stores
3. Theme versioning with Git
Keep one branch per stage:
main: live themestaging: changes ready for previewdev: active development
Tag each release, so you can roll back to it:
git tag v1.2.0 && git push origin --tags
Merchants can still change settings and content in the theme editor, which writes to config/settings_data.json and the JSON templates. Pull those changes into Git before you push, or a deploy can overwrite their work:
shopify theme pull --environment production --only config/settings_data.json --only "templates/*.json"
4. Use preview themes
Push changes to a new unpublished theme. The CLI asks you to name it:
shopify theme push --unpublished
Share the preview link with the client, or whoever tests, before you publish.
5. Keep debug code out of the live theme
A preview theme runs on the same store and domain as the live one, so you can’t detect it from the shop’s domain. Gate debug output behind a theme setting that stays off in the published theme:
{% if settings.debug_mode %}
<!-- Debug scripts -->
{% endif %}
Add the matching checkbox to config/settings_schema.json. For behaviour that should only run inside the theme editor, check request.design_mode.
6. Deploy app extensions safely
For custom apps with extensions:
- Use a separate development app and store for testing
shopify app deploycreates a new app version and releases it, so treat it as a production release- Watch the app’s logs and error reporting after each release
7. Scheduled launches
For a launch at a fixed time, do the risky part early:
- Push the finished theme to an unpublished theme a day or more ahead, and get it approved
- Snapshot the live theme with
shopify theme pullso you can roll back - At launch time, publish from a scheduled CI job:
shopify theme publish --theme <id> --force - Post the result to Slack or email so someone knows it happened
A real example
On a Shopify Plus rebuild for a UK jeweller, the site handled seasonal campaign traffic without issues.
Related reading
How a developer deploys to your live store is worth asking before you hire them. My guide to hiring a Shopify developer lists the other questions, and the steps above are how I run the Shopify builds I take on.
Published , updated .
Part 7 of Shopify Essentials.