A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
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
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 } } } }
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.