All things Shopify and commerce
Hi Shopify Community,
I’ve been facing an issue with the Theme Editor not recognizing certain inputs in Liquid. I believe the problem might be related to how Shopify handles dynamically specified data versus pre-defined options in the code.
Here’s the background:
I’m trying to display a promo banner on specific collection pages selected in the Theme Editor. The setup is as follows:
Schema Setup
{
“type”: “collection_list”,
“id”: “selected_collections”,
“label”: “Allowed Collections”,
“info”: “Select the collections where the promo banner will appear.”
}
Liquid Logic
{%- assign allowed_collections = settings.selected_collections | split: “,” -%}
{%- if allowed_collections contains collection.handle -%}
{% endif %}
The Issue:
The settings.selected_collections data from the Theme Editor is consistently empty when accessed in Liquid, even after selecting collections and saving. Debugging confirmed this:
Selected Collections: {{ settings.selected_collections }}
This always outputs an empty value, regardless of what I select in the Theme Editor.
Debugging I’ve Done:
{%- assign allowed_collections = “collection-1,collection-2” | split: “,” -%}
{%- if allowed_collections contains collection.handle -%}
{% endif %}
This confirms the issue lies with settings.selected_collections.
I tried using other types like product_list, but the data from the Theme Editor was also not recognized.
Free Themes: I tested this logic with free Shopify themes and encountered the same issue, which suggests it’s not specific to a custom theme.
Alternate Logic Works for Pre-Defined Options:
I’ve had a similar issue when working with country restrictions. For example:
-If I use a dropdown in the Theme Editor with pre-defined country options set in the schema (e.g., DE, US, FR), the Liquid code correctly recognizes the selection.
-If I use a text field in the Theme Editor to allow users to enter country codes dynamically (e.g., DE,US,FR), Shopify fails to recognize the input in Liquid.
My Hypothesis:
The problem might be that Shopify’s Liquid cannot reliably work with inputs that are dynamically defined by the user at runtime via the Theme Editor. If the available options for a setting (e.g., collection_list, text) are not explicitly defined in the schema or the code, Shopify seems to fail to process the data correctly.
For example:
-A dropdown with pre-defined options works perfectly because Shopify knows all valid inputs in advance.
-A text field or dynamically defined collection list seems to fail because Shopify cannot validate or process the input effectively.
Question:
Is there a known limitation in Shopify where dynamically defined inputs (e.g., collection_list or text fields) are not processed correctly in Liquid?
Is it necessary to pre-define all available options in the schema for Shopify to handle these inputs properly?
If so, how can I create a flexible solution for scenarios where options (like collections or country codes) are not known in advance and need to be defined dynamically by the user?
This issue has been consistent across different themes (including free Shopify themes) and impacts key functionalities where dynamic user inputs are required. Any guidance or insights would be greatly appreciated!
Thank you!
Linus
Version: Enterprise-Version 1.4.2
@Linus_Paul if your are referencing the schema settings from the section, you should request them by using
{{ section.settings.selected_collections }}
Furthermore, if you are using the "contains" function using a handle, you should handleize the variable to have matching values.
{%- assign allowed_collections = "collection-1,collection-2" | split: "," -%}
{% for collection in allowed_collections %}
{% assign collection_handle = collection | handle %}
{%- if collection_handle == collection.handle -%}
Banner
{% endif %}
{% endfor %}
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025