Why isn't my conditional flow working in Shopify?

precision_efi
Tourist
9 0 0

hi im trying to make a flow similar to :

{% if customer.tags contains 'dealer' and product.tags does not contains 'customerstage'%}
  {% render 'product-accordions' %}   
{% endif%}
 
or something like
{% if customer.tags contains 'dealer' %}
      {% render 'product-accordions' %}
{% elsif product.tags contains 'customerstage'%}
      do nothing 
{% endif%}
 
i've tried to replace my do nothing in the second flow with a text flow but the product-accordions is always showing
 
any help will be appreciate thank you !
Replies 2 (2)

paul_n
Shopify Staff
850 122 205

I don't think `does not contain` is valid liquid. Also, your second example is not the same logic as the first and it would always output if dealer is in the tags.

I think you want `unless` instead of does not contain, but you need to nest that condition instead the if statement. 

 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.

DutchDelight
Excursionist
19 0 4

According to https://shopify.github.io/liquid/tags/control-flow/ you can use 'unless' instead of an if-then statement.