Shopify themes, liquid, logos, and UX
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.
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025