I am outputing a value based on collection title in shopify
<code>{% for collection in product.collections %}
{% if collection.title contains "China" %}
This is china
{% endif %}
{% endfor %}
{% for collection in product.collections %}
{% if collection.title contains "China,vietnam" %}
This is china and vietnam
{% endif %}
{% endfor %}
</code>
<code>{% for collection in product.collections %}
{% if collection.title contains "China" %}
This is china
{% endif %}
{% endfor %}
{% for collection in product.collections %}
{% if collection.title contains "China,vietnam" %}
This is china and vietnam
{% endif %}
{% endfor %}
</code>
{% for collection in product.collections %}
{% if collection.title contains "China" %}
This is china
{% endif %}
{% endfor %}
{% for collection in product.collections %}
{% if collection.title contains "China,vietnam" %}
This is china and vietnam
{% endif %}
{% endfor %}
But the issue iam facing is, it is outputing both values which is
1)This is china
2)This is This is china and vietnam
can someone help to check, where the issue is
But the issue iam facing is, it is outputing both values which is
1)This is china
2)This is This is china and vietnam
New contributor
Rahul Dogra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.