Main issue: Residual, now-invalid settings persist in settings_data.json after removing section/block schema during a migration to metaobjects, creating thousands of redundant lines and causing theme deployment failures via Shopify x GitHub.
Metaobjects: newer structured data model for managing content.
Proposed solutions:
Request a fresh theme copy from the Shopify Theme Store to reset to default/clean JSON (if feasible for the project).
Write a Python/JS script to parse settings_data.json and remove keys for deleted sections/blocks, enabling selective cleanup.
Workaround reported:
Instead of deleting the settings data file, clear its contents so it contains an empty object for the current attribute, then save with the new schema. This regenerated a clean settings data file without redundant entries for one user.
Status/outcome:
Actionable options identified (scripted cleanup or empty-file regeneration). A platform feature request to auto-purge orphaned settings data is suggested. Discussion remains open; no official tool confirmed.
Summarized with AI on December 21.
AI used: gpt-5.
Does anyone have a method of dealing with residual settings data (in settings_data.json for instance) when you delete schema (settings) for sections or blocks etc?
For context, we had built quite a complex product customiser feature for one of our clients and we did so all using theme code with sections and blocks etc.
With the release of metaobjects we now have a much better way for them to manage of this data, so we are in the process of migrating all of the old section and block settings etc. to metaobjects.
However when we then proceed with cleaning up the section schema by removing the old redundant blocks schema, the result is that there are literally thousands of lines of redundant code in our settings_data.json file and this causes the deployment* of the theme code to fail.
Manually searching through this code for all the invalid block types etc. stored in the settings_schema.json file will take a very, very long time and will also be very prone to human error.
Does anyone have a method for dealing with this kind of situation?
*We are using the Shopify x Github integration to deploy code to the Shopify themes.
Is the theme your using, originally sourced from the Shopify theme store? If so, you could request a fresh version of the theme which would have empty / default settings, and cleaner JSON files. Alternatively, if you’re comfortable with creating custom scripts in Python/ JS, you could potentially write a script to automate this process. The script would need to parse the JSON file, delete the keys related to the redundant blocks or sections, and then write the cleaned-up JSON back to the file.
Great to hear from you again, I hope you’re keeping well! And thanks for your response.
Yes, the theme is from the official theme store, however it is based on a very old (OS 1.0) version of the theme from a couple years back. In addition, we are not currently looking to delete all of the data, just certain blocks that we have deleted from the section schema.
I think a python script would probably have to be the way to go.
But I must say it would be great if Shopify had a way of dealing with this. Like if there is data for sections or block types that no longer exist in the theme, then just delete that invalid data from the theme. Would that be possible to add as a feature request?
This was driving me wild! So if you just delete the settings data file and then save with a new schema it writes redundant data into the schema e.g. data from fields that have been removed from the schema. Instead of deleting I just removed all of the contents of the JSON leaving an empty object for the current attribute. No idea if this is the best strategy or why it works - but I then get a nice clean schema data file after saving the again.