A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hi,
We need to add tags to shopify orders. To do this we are using tagsAdd mutation. Here is our mutation
mutation addTagsToOrder($id: ID!, $tags: [String!]!) {
tagsAdd(id: $id, tags: $tags) {
node {
id
}
userErrors {
field
message
}
}
}
and here is a sample input for this mutation
{
"id":"gid://shopify/Order/4911931326705",
"tags": ["test"]
}
We are getting following response / error from Shopify
{
"response": {
"data": {
"tagsAdd": null
},
"errors": [
{
"message": "TagsAdd access denied",
"locations": [
{
"line": 3,
"column": 9
}
],
"path": [
"tagsAdd"
]
}
],
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 1000,
"currentlyAvailable": 990,
"restoreRate": 50
}
}
},
"status": 200
},
"request": {
"query": "\n mutation addTagsToOrder($id: ID!, $tags: [String!]!) {\n tagsAdd(id: $id, tags: $tags) {\n node {\n id\n }\n userErrors {\n field\n message\n }\n }\n }\n",
"variables": {
"id": "gid://shopify/Order/4911931326705",
"tags": [
"test"
]
}
}
}
One thing to note here is above mutation is in try catch statement and this error comes in catch part i.e it is not a usererror.
we already are doing lots of order edit before doing this mutation like inventory adjustment and ordereditbegin mutations.
Our Api Scopes are as follows
"write_products,read_orders,write_order_edits,write_merchant_managed_fulfillment_orders,write_third_party_fulfillment_orders,write_inventory"
We are using Oct'21 Version of the API.
Could someone point out if we are missing anything obvious.
Thank you
Abhinav
Solved! Go to the solution
This is an accepted solution.
I think you need the write_orders scope to be able to add tags to orders.
This is an accepted solution.
I think you need the write_orders scope to be able to add tags to orders.