Packing slip template liquid operator ends up with duplicate

Why does this liquid in the packing slip template

{% for tag in order.tags %}
	{% if tag != 'wholesale' %}
		

B2C

	{% else %}
		

B2B

	{% 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.

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 %}
1 Like

Thats it! Thanks Tim.

1 Like