Content wiped from JSON template

4 0 1

Hi there!

I'm using Theme Kit to build a theme. Recently, after watching Shopify Unite 2021, I was interested in building a new page using a JSON template. Even though I've read in the docs that it is not supported through Theme Kit, I decided to try anyway. And surprisingly it worked and I really liked the idea. Everything was great until I needed to deploy/publish new changes to the theme, not related to that JSON template. Firstly, I tried publishing 'development' theme which was a duplicate of the live theme with new changes added. Secondly, I tried deploying new changes via 'theme deploy' command. But in both cases the content of my page using JSON template was wiped out. I wonder if this is the expected behavior? Is there any way to make sure that the content is not getting wiped out when I'm introducing new changes not related to that template? Should I switch to using Shopify CLI instead of Theme Kit to avoid this issue?


Replies 2 (2)
Shopify Partner
826 21 142

Previously, section settings were saved to settings_data.json. Now, these settings are saved to json template files. 

if you are re-uploading empty .json template files, the section settings are wiped out.

I spend an hour reading the migration guide and realize the issue here.

BYOB - Build Your Own Bundles, SPO - SEO App to research keywords & edit social link preview
1 0 1

I've been working on a new Online Store 2.0 theme and have come to this realization as well. The migration guide does state multiple times that Theme Kit is not the ideal choice for working with Online Store 2.0 themes, so I should have seen the writing on the wall. It seems we really need to buy into the new Shopify CLI workflow and GitHub integration to work safely with Online Store 2.0 themes.

As mentioned in the GitHub integration docs, modifications made in the theme editor, code editor, or by apps are committed to the Git repo. This would ensure that all theme changes are accounted for and merged. This is likely to prevent what happens if you deploy JSON templates through Theme Kit that don't have the changes made in the Shopify admin. What I'm currently unsure of is if the shopify push pushes changes to the repo or just deploys files directly to the theme. If it doesn't go through GitHub, then you could potentially overwrite a JSON template there too.

If you wanted to continue using Theme Kit, you could theme download first before making any local changes. However, it that's likely just going to overwrite your local files and not provide the ability to review those changes pre-merge. As well, I'm not entirely clear just yet on what all the GitHub integration commits to the repo. The docs mention that themes should be buildless in the Repository structure section, which isn't a problem for me since I build my CSS and JavaScript assets locally. However, I'm unsure how a local build process works when pushing changes via Shopify CLI and the GitHub integration (I don't currently commit my built CSS and JavasScript files).

Probably more new questions than answers in there, but I'm trying to understand the best approach to adopt the "Online Store 2.0 Way". Right now, it's looking like my existing workflow is going to need some significant changes due to the new JSON templates storing settings and data.