Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Re: DraftOrderCalculate access denied

DraftOrderCalculate access denied

travis-ENL
Tourist
4 0 1

I'm receiving this error when trying to run the following GraphQL mutation:

 

 

{
   "query":"mutation draftOrderCalculate($input: DraftOrderInput!) { draftOrderCalculate(input: $input) { userErrors { field message } calculatedDraftOrder { totalTax } } }",
   "variables":{
      "input":{
         "lineItems":[
            {
               "variantId":"gid://shopify/ProductVariant/40512334692549",
               "quantity":1,
               "appliedDiscount":null
            }
         ],
         "shippingAddress":{
            "firstName":"Eduard",
            "lastName":"...",
            "address1":"...",
            "address2":"...",
            "phone":"123",
            "city":"Miami",
            "countryCode":"US",
            "provinceCode":"FL",
            "zip":"123"
         },
         "billingAddress":{
            "firstName":"Eduard",
            "lastName":"...",
            "address1":"...",
            "address2":"...",
            "phone":"123",
            "city":"Miami",
            "countryCode":"US",
            "provinceCode":"FL",
            "zip":"123"
         },
         "email":"eduard@example.com"
      }
   }
}

 

 

Error:

 

{
    "data": {
        "draftOrderCalculate": null
    },
    "errors": [
        {
            "locations": [
                {
                    "column": 58,
                    "line": 1
                }
            ],
            "message": "DraftOrderCalculate access denied",
            "path": [
                "draftOrderCalculate"
            ]
        }
    ],
    "extensions": {
        "cost": {
            "actualQueryCost": 10,
            "requestedQueryCost": 10,
            "throttleStatus": {
                "currentlyAvailable": 990,
                "maximumAvailable": 1000.0,
                "restoreRate": 50.0
            }
        }
    }
}

 

My private app the write_draft_orders scope  (screenshot).

 

All app permissions: read_products,write_products,read_orders,write_orders,write_order_edits,read_collection_listings,read_shipping,write_shipping,read_draft_orders,write_draft_orders

 

 

Screen Shot 2021-11-22 at 10.56.06 AM.png

Replies 2 (2)

travis-ENL
Tourist
4 0 1

This doesn't make any sense. 

 

{ draftOrders(first: 10) { edges { node { id } } } }


Returns: Access denied for draftOrders field.

 

I deleted the custom app and re-installed it, verified that the oAuth URL generated included the correct scopes for draft orders, and the app summary clearly says that I will be granting the app permission to edit draft orders. But I get the access denied error. 

 

I installed the Shopify GraphiQL app and granted it permission to edit draft orders, and it works. 

 

My app can access orders through, but not draft orders. 

 

{ orders(first: 10) { edges { node { id } } } }

 

 

Screen Shot 2021-11-22 at 12.44.50 PM.png

travis-ENL
Tourist
4 0 1

Ok - I did make a mistake, I didn't update the API token when I uninstalled the app and re-installed it. 

 

Deleting the app, and re-installing from scratch was required for some reason though.