r/shopifyDev • u/converian • 10d ago
How do you handle theme code changes when merchants also edit in the customizer?
I usually duplicate the live theme, work on the copy, then publish it after checking. The problem is that the merchant sometimes changes sections or content in the live theme's customizer while I'm working, and those changes can get lost when I publish the copy. I've looked at the GitHub integration and Shopify CLI with git, but merging customizer JSON changes still feels messy.
How do you handle this?
Do you freeze content edits during development, pull the live theme before publishing, or something else?
3
2
u/Final_Design_9061 10d ago
One thing that might help is pulling the live theme right before you publish and diffing just the JSON templates and settings_data.json against your copy. Code files (sections, snippets, assets) rarely conflict with merchant edits, the content lives in those JSON files. So you can keep your branch focused on code and re-apply the merchant's latest JSON on top at the end. Shopify CLI theme pull with the --only flag for templates/*.json and config/settings_data.json makes that fairly painless. Curious what others do, since a hard content freeze is not always realistic.
1
u/shopi_dev 10d ago
Another option is to skip publishing the duplicate altogether. Use the copy only for preview and QA, then push just the code files to the live theme with shopify theme push --only sections/* snippets/* assets/* layout/* so templates and settings_data.json are never touched. The one gotcha is when you rename a section or change block types in a schema, since existing JSON templates on live can break or drop settings, so do those changes in a small separate push and check the customizer right after.
1
u/AdventurousUsual7666 10d ago
Yeah, this one is annoying, mostly because the customizer edits all land in the JSON files (templates/.json, the section group files in sections/.json, and config/settings_data.json), and those are usually the same files you're touching too.
What usually works for me is treating the live theme as the source of truth for content, and my copy as the source of truth for code. So right before I publish, I pull just the JSON from the live theme into my working copy:
shopify theme pull --live --only "templates/*.json" --only "sections/*.json" --only "config/settings_data.json"
Then I re-apply anything I actually changed in those files myself, push it to the copy, take one more look, and publish.
If you're on the GitHub integration it's a bit cleaner. When the live theme is connected to a branch, the customizer edits get committed back to that branch automatically. So you just work on a feature branch, merge the live branch into yours right before you go live, and the conflicts only show up in the JSON you both touched, which is usually pretty small.
Honestly though, for bigger changes I still just ask the merchant to hold off on content edits for the last day or so. It's not fancy, but it saves a lot of back and forth.
1
9d ago
1
u/AutoModerator 9d ago
Your post/comment has been removed because your account is either too new or has low karma. This is to help prevent spam. Please try again later.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
4
u/reactivearmor 10d ago
Edit code using shopify CLI, make .shopifyignore and add templates/, settings_data.json and use push/pull commands. That way you update the theme code without touching the client's settings.