settings_data.json
The settings_data.json
file contains the setting values for a theme based on the settings included in settings_schema.json.
For example, you can use the following theme setting to allow a merchant to choose a color for the page background:
[
{
"name": {
"en-US": "Colors",
"zh-CN": "颜色"
},
"settings": [
{
"type": "color",
"id": "color_body_bg",
"label": {
"en-US": "General background",
"zh-CN": "常规背景"
},
"default": "#FFFFFF"
}
]
},
...
]
This adds an entry for color_body_bg
in settings_data.json
:
{
"current": {
"color_body_bg": "#FFFFFF"
}
}
Tip
In this example, the value of
color_body_bg
is#FFFFFF
due to the default setting attribute.
Any time that the value of color_body_bg
is changed in the theme editor, settings_data.json
is updated with the new value.
Location
The settings_data.json
file is located in the config
directory of the theme:
└── theme
...
├── config
├── settings_data.json
├── settings_presets.json
└── settings_schema.json
└── locales
Schema
The settings_data.json
file has the following parent objects:
Object | Description | Required |
---|---|---|
current | Contains all of the setting values that are currently saved in the theme editor. | Yes |
metafields | Contains a theme type of the setting value that can distinguish technology type such as plugin of the current theme. | No |
For example:
{
"current": {
"color_body_bg": "#FFFFFF",
...
},
"metafields": {
"theme_type": "standard" // Indicates that the technology is not jQuery
}
}
Updated over 1 year ago