Short description of issue
The new “visible_if” properties we can use within Block and Section schema is great but I am running into a lot of limitations and can’t seem to get around them. First, it doesn’t appear to be supported by all schema inputs (eg. Collection, Product, Blog select and URL fields). Second, we appear to be limited to straight up IF statements with very little flexibility.
Reproduction steps
- In your theme section or block schema, create a new input field
- add a “visible_if” attribute
- add your conditional logic like “{{ block.settings.some_other_field == ‘testing’ }}”
Additional info
Example use cases:
- Create a select input called “type” allowing you to choose Product, Collection, or Blog Post. Then create Product, Collection, and Blog selection inputs with something like “visible_if”: {{ block.settings.type == “Product” }} to show the correct one where needed. This doesn’t work since these inputs do not support the visible_if attribute for some reason. Works for other inputs though.
- Create a single URL field and then show fields with something like “visible_if”: {{ block.settings.url contains “/products/” }}. This works but cannot be combined with AND/OR and cannot be used to check false. Like you cannot do {{ ( this AND this ) OR this }} and cannot do {{ this contains “this” == false }}
I’m open to input on other ways I can do this. If not, this feels like a feature request.
What type of topic is this
Feature request
General discussion