Tag order by shipping method does not work

Hi all.

I try to tag my orders by the shipping method chosen at checkout.

I get it working until the shipping method is a single word like “courier” i get the tag “courier” written.

I have shipping methods written like “courier shipping 4-6 days” and i cannot get them tagged.

this is written in the action to create the tag

{% for shippingLines_item in order.shippingLines %} {{shippingLines_item.title}},{% endfor %}

i cannot rename my shipping methods so i wonder if there is some solution for this.

Thanks in advance

It’s possible they are either too long or contain invalid characters. Hard to say without seeing an error message from a workflow run

Thanks @paul_n for your reply.

The first thing i was looking was the error message but it wasn’t really helpful

i think it is or the “-” or " the “(” “)” i use in the text.

because they are like this:

Schermata_20240726_221933.png

So i made a test without brackets and it works.

Is there a workaround to get the old ones tagged because i cannot export/import orders changing the text

Thanks in advance

It’s tell you the tags you are trying to insert are invalid.

I’m not sure what you are showing there, but you can use liquid to find and replace characters, and also to truncate long strings.

https://shopify.github.io/liquid/filters/replace/

https://shopify.github.io/liquid/filters/slice/

Great. That’s exactly what i need. Thanks a lot