Zaman Global Limited
Zaman Global Limited

Reputation: 11

Multiple if condition not working on shopify liqued file

How are you. I use this code bellow for multiple if condition in shopify liqued file. but it's not working. Please anyone help where I mistake here.

{%- if product_collection == "Organic and Natural Products" and product_collection == "Dried Foods" -%} CONTENT HERE A {%- else -%} CONTENT HERE B {%- endif -%}

Upvotes: 0

Views: 131

Answers (1)

David Lazar
David Lazar

Reputation: 11427

The simple explanation is your logic is wrong. A quick example of what I mean:

if A is 3 AND A is 5 do something

Do you see the problem here? A can NEVER be two things at once. Instead, you probably want the or condition. That way, you get choices.

if A is 3 OR A is 5 do something

Then, your logic will display specific content when either condition for A is true. Otherwise you get the content when neither is true.

Upvotes: 1

Related Questions