Order rest api update tag removes the previous tags

hexonsoft
Tourist
6 0 1

Hi, I am using shopify order rest api put request to update order tag but when I run the PUT request it removes the previous order tags. I want to keep the old tags and add the new tags in order.

Same happen with order notes.

Is there any solution ?

Link: https://shopify.dev/api/admin/rest/reference/orders/order#update-2021-07

Update an order's tags

PUT /admin/api/2021-07/orders/450789469.json
{
  "order": {
    "id": 450789469,
    "tags": "External, Inbound, Outbound"
  }
}
Reply 1 (1)
tommydev
Excursionist
15 0 3

Dear hexonsoft,

 

with the REST API, I think it is not possible to keep the old tags while performing a PUT request. However I noticed, that it is possible by using the GraphQL API. There is a mutation to add tags: https://shopify.dev/api/admin-graphql/2021-10/mutations/tagsAdd and it kept the previous tags, when I execute it.

 

For example:

 

mutation tagsAdd {
  tagsAdd(id: "gid://shopify/Order/<your_order_id>", tags: "Test") {
    node {
      id
    }
    userErrors {
      field
      message
    }
  }
}

 

 

Greetings, Tom