Hussam Kurd
Hussam Kurd

Reputation: 9166

Add Dynamic content in {% schema %} section for Shopify Theme

According to Shopify theme tutorial https://help.shopify.com/themes/development/theme-editor/settings-schema

files, we can define theme setting through set {% schema %} part like the following example:

{% schema %}
{
  "name": "Line",
  "class": "index-section",
  "settings": [
    {
      "type": "radio",
      "id": "small_line",
      "label": "Correct Gap",
      "options": [
        {
          "value": "none",
          "label": "None"
        },
        {
          "value": "gap1",
          "label": "Different Gap"
        }
      ],
      "default": "none"
    }
  ],
  "presets": [
    {
      "name": "Line",
      "category": "Design",
      "settings": {
      }
    }
  ]
}
{% endschema %}

My question if there is a way we can set this settings to be dynamic in the schema part like define "small_line" options as a variable in the above example, something similar to the following

{% schema %}
{
  "name": "Line",
  "class": "index-section",
  "settings": [
    {
      "type": "radio",
      "id": "small_line",
      "label": "Correct Gap",
      "options": MY_OPTIONS_VAR,
      "default": "none"
    }
  ],
  "presets": [
    {
      "name": "Line",
      "category": "Design",
      "settings": {
      }
    }
  ]
}
{% endschema %}

Upvotes: 1

Views: 5024

Answers (1)

drip
drip

Reputation: 12943

No you can't add any liquid code in your schema object.

Everything there needs to be entered as static information.

Upvotes: 2

Related Questions