How can I add an order tag to the liquid template for retail and wholesale?

If you’re doing this in the order notification email, try this:

{% for tag in tags %}
  {% if tag contains "wholesale" %}
    

{{ tag }}

  {% endif %}
{% endfor %}

With those notifications it already accesses the order object, so you go directly to the property (tags). Reference: https://help.shopify.com/en/manual/orders/notifications/email-variables#order-fulfillment