Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.
Solved

Unable to add tags to an order due to Access Denied Error

ProfitLabs
Shopify Partner
118 5 15

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

Abhinav | Shopify Partner
- If helpful, please Like and Accept Solution.
- Creator of Sync Inventory - GoGo - Sync Inventory Across Multiple or Single Shopify Store .
- Creator of Profit Bundles - Sell Omni Sales Channel Bundles that you can fulfill yourself or even by a 3PL or Dropshipper.
Accepted Solution (1)

DeJoy
Shopify Partner
27 2 4

This is an accepted solution.

I think you need the write_orders scope to be able to add tags to orders.

SAGE Apps | Automatically alert your subscribers when you add new products with Vye: Automated Email Alerts | Email: contact@sage-apps.com

View solution in original post

Reply 1 (1)

DeJoy
Shopify Partner
27 2 4

This is an accepted solution.

I think you need the write_orders scope to be able to add tags to orders.

SAGE Apps | Automatically alert your subscribers when you add new products with Vye: Automated Email Alerts | Email: contact@sage-apps.com