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.
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025