Hi guys,
I am working on this code.
{% assign USVendors = "
customcat,
gearment,
melaninfulcc
" %}
{% assign USVendorArray = USVendors | split: "," %}
{% assign ProductVendor = product.vendor | downcase | strip %}
{% assign USShipped = false %}
{% for item in USVendorArray %}
{% if item == ProductVendor %}
{% assign USShipped = true %}
{% break %}
{% endif %}
{% endfor %}
{{ USShipped }}
Product.type is ‘CustomCat’ in this case. I expect USShipped to return as “true” but it always shows “false”. But if I use “contains” instead of “==” in the if line, it works perfectly.
{% for item in USVendorArray %}
{% if item contains ProductVendor %}
{% assign USShipped = true %}
{% break %}
{% endif %}
{% endfor %}
I don’t understand where I did wrong. Can you please help me?