-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
Description
It appears that the assign operator doesn't like comparisons (i.e. [thing] contains [other thing]). For instance, I would expect this to work:
{%- assign is_some_product = variant.tags contains "example" -%}
But produces the error: Expected end_of_string but found comparison in [...]
I've used the following as a workaround:
{% if variant.tags contains "example" %}
{%- assign is_some_product = true -%}
{% else %}
{%- assign is_some_product = false -%}
{% endif %}
While the latter works, the former is much more concise and is what I would expect to work. Note that I found this while trying to use the or operator as well, but seeing as comparisons themselves aren't accepted, I don't think the parser even got that far.
edit 10/30/2020: The following snippet also works and is a bit more compact:
{%- assign is_some_product = false -%}
{% if variant.tags contains "example" %}
{%- assign is_some_product = true -%}
{% endif %}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Fields
Give feedbackNo fields configured for issues without a type.