Shopify themes, liquid, logos, and UX
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Why does this liquid in the packing slip template
{% for tag in order.tags %}
{% if tag != 'wholesale' %}
<p>B2C</p>
{% else %}
<p>B2B</p>
{% endif %}
{% endfor %}
Result in
B2C
B2C
when i print packing slip from a order that does not include the tag wholesale?
If i print packing slip from order with wholesale tag it prints B2B one time.
Solved! Go to the solution
This is an accepted solution.
Hey, your code loops over order tags and for each of them outputs something. So, if the order has 2 tags, it will output 2 lines, if order has 3 tags it will produce 3 lines.
I'd suggest this code instead:
{% if order.tags contains "wholesale" %}
B2B
{% else %}
B2C
{% endif %}
This is an accepted solution.
Hey, your code loops over order tags and for each of them outputs something. So, if the order has 2 tags, it will output 2 lines, if order has 3 tags it will produce 3 lines.
I'd suggest this code instead:
{% if order.tags contains "wholesale" %}
B2B
{% else %}
B2C
{% endif %}
Thats it! Thanks Tim.