How do I correctly add a tag when updating an order?

How do I correctly add a tag when updating an order?

raderic
Shopify Partner
3 0 0

hi - i am updating(PUT) an order and adding a tag 

tags: "ONLINE-EU",
 
however this fails unless it reads
tags: "ONLINEEU",
Does anyone have thoughts on how to do this correctly?
const updateShippingAddress = {
method: "PUT",
body: JSON.stringify({
    order: {
    id: order,
    shipping_address: {
        name: gb_name,                      
    },
    tags: "ONLINE-EU",                   
    }
})
};

api.request(
    `${api.endpoints.SHOPIFY_ORDER(order)}`,
    updateShippingAddress
)
Replies 7 (7)

Visely-Team
Shopify Partner
1843 210 488

What is the exact error you are seeing?

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
raderic
Shopify Partner
3 0 0
{"errors":{"order_tags":["is invalid"]}}
Visely-Team
Shopify Partner
1843 210 488

Looks like a bug to me, as there are no documented constraints on using dashes in tag names.

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
PaulNewton
Shopify Partner
7722 678 1627

Log the actual request being made to verify it's not being mangled by bad url encoding

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org


aicukltd
Visitor
2 0 0

Has there been any update to this? I am receiving the same problem over 3 years later.

 

Our business tag policy is hyphenated words.

 

My X-Request-Id : 6548bf5a-e0ea-49e4-b6a6-bf3447e41bee

aicukltd
Visitor
2 0 0

Did you ever manage to resolve this?

james148
Shopify Partner
27 0 12

I think you'll find there's an issue with mixed capitalisation.

 

The API allows you to set a tag with a capital, for example: Success.

 

If you attempt to update that same record with a tag in lower case (success) you will get the 422 error. My assumption here is that Shopify maintains a list of known tags and you cannot have two different tags of different capitalisation...i.e. this is a collation sequence issue.

 

The UI prevents this as you cannot create two tags with differing capitalisation.