I’m working on a Shopify theme and trying to set up spacing controls that can switch between simple and advanced modes.
What I want to achieve:
- Basic mode: One setting that controls spacing for all sides of a section
- Advanced mode: Separate controls for each side (top, right, bottom, left)
- The advanced controls should only show up when the user enables them
My current setup:
{
"type": "number",
"id": "section_spacing",
"label": "Section Spacing (All Sides)",
"min": 0,
"max": 80,
"step": 4,
"default": 16
},
{
"type": "checkbox",
"id": "use_custom_spacing",
"label": "Use Custom Spacing Per Side",
"default": false
},
{
"type": "number",
"id": "spacing_top",
"label": "Top Spacing",
"default": 16,
"hidden": "{{ section.settings.use_custom_spacing == false }}"
},
{
"type": "number",
"id": "spacing_right",
"label": "Right Spacing",
"default": 16,
"hidden": "{{ section.settings.use_custom_spacing == false }}"
},
{
"type": "number",
"id": "spacing_bottom",
"label": "Bottom Spacing",
"default": 16,
"hidden": "{{ section.settings.use_custom_spacing == false }}"
},
{
"type": "number",
"id": "spacing_left",
"label": "Left Spacing",
"default": 16,
"hidden": "{{ section.settings.use_custom_spacing == false }}"
}
The problem: The individual spacing controls aren’t hiding when the checkbox is unchecked. It seems like the hidden property isn’t working the way I expected.
Has anyone figured out how to make section settings appear and disappear based on other settings? Is there a different way to handle this in Shopify themes?