What is The difference between settings_data.json and settings_schema.json file in shopify, i can set theme settings by both, but i will use which one for when exactly? I am giving an example in below where is displayed Setting_schema.json file and Setting_data.json file both but i can understand both are creating same functionality in admin section. But What is the difference between then. Why shopify theme used two type settings json file?
/**Here is Setting_schema.json file :**/
[
{
"name": "theme_info",
"theme_name": "Minimal",
"theme_author": "Shopify",
"theme_version": "1.0",
"theme_documentation_url": "https://docs.shopify.com/manual/more/official-shopify-themes/minimal",
"theme_support_url": "https://support.shopify.com/"
},
{
"name": "Layout",
"settings": [
{
"type": "checkbox",
"id": "enable_wide_layout",
"label": "Enable wide layout"
}
]
},
{
"name": "Colors",
"settings": [
{
"type": "header",
"content": "Background"
},
{
"type": "checkbox",
"id": "theme_bg_image",
"label": "Use theme background"
},
{
"type": "image_picker",
"id": "bg_custom",
"label": "Custom image"
},
{
"type": "radio",
"id": "bg_image_display",
"label": "Image display",
"options": [
{
"value": "tile",
"label": "Tile"
},
{
"value": "stretch",
"label": "Stretch"
}
]
},
{
like this…
/**And Here is Schema_data.json code:**/
{
"current": {
"enable_wide_layout": false,
"theme_bg_image": false,
"bg_custom": "",
"bg_image_display": "tile",
"color_topbar_bg": "#eeeeee",
"color_body_bg": "#ffffff",
"color_footer_bg": "#eeeeee",
"color_borders": "#dddddd",
"color_primary": "#ab094b",
"color_button_primary_text": "#ffffff",
"color_secondary": "#767676",
"color_button_secondary_text": "#ffffff",
"color_topbar_text": "#a8003e",
"color_header_text": "#595556",
"color_body_text": "#5b5252",
"color_footer_text": "#555555",
"color_footer_social_link": "#555555",
"type_base_family": "'HelveticaNeue', 'Helvetica Neue', Helvetica, Arial, sans-serif",
"type_base_size": "16px",
"type_header_family": "Google_PT+Serif_700_serif",
"type_header_size": "36px",
"type_accent_family": "Google_Lato_400_sans",
"type_accent_size": "16px",
"type_accent_transform": false,
"type_accent_spacing": false,
"favicon": "shopify://shop_images/color_transparent_500px_81b18ab4-183c-480f-ba6a-529b0e9e665c.png",
"social_twitter_link": "",
"social_facebook_link": "",
"social_pinterest_link": "",
"social_google_plus_link": "",
"social_instagram_link": "",
"social_snapchat_link": "",
"social_tumblr_link": "",
"social_youtube_link": "",
"social_vimeo_link": "",
"social_fancy_link": "",
"social_rss_link": "",
"share_facebook": true,
"share_twitter": true,
"share_pinterest": true,
"social_sharing_style": "normal",
"checkout_header_image": "",
"checkout_logo_image": "shopify://shop_images/color_transparent_500px_e0d779f9-b33c-47b1-bb14-fb8fde7411d7.png",
"checkout_logo_position": "left",
"checkout_logo_size": "medium",
"checkout_body_background_image": "",...........
like this as a example
I can see both outputting theme setting option in admin panel Then what is difference between those?
What is The difference between settings_data.json and settings_schema.json file in shopify, i can set theme settings by both, but i will use which one for when exactly? I am giving an example in below where is displayed Setting_schema.json file and Setting_data.json file both but i can understand both are creating same functionality in admin section. But What is the difference between then. Why shopify theme used two type settings json file?
2
Answers
The schema file is here for generating/creating/editing options for your theme which will be displayed in theme interface for user. It is the one you use to create options (setting all parameters such ID, type, label, etc…).
The data file is recording all option values. It’s sort of database in JSON. It might be used to modify an option value or a theme preset directly in the theme without using user interface.
Schema manages keys and data stores values set by user.
From Shopify post: link
settings_schema.json vs. settings_data.json
The settings_schema.json file controls the organization and options available to a merchant in the theme editor. It’s used to create and edit the theme settings available for a merchant within a theme. The theme settings follow the specified file format outlined by the Shopify documentation.
The settings_data.json file stores the theme settings data saved from the theme editor. It can also include ‘theme styles’, also known as presets. If presets are defined, it enables a merchant to choose a theme style which is predetermined by a theme developer. The theme style then sets specific values for the keys defined in the settings_schema.json file.