Shopify has tightened security around draft orders. Starting now, any attempt to add a discount code or enable automatic discounts via the draftOrderCreate or draftOrderUpdate mutations will fail with an ACCESS_DENIED error unless the staff member executing the request holds the apply_discounts_to_draft_orders permission. This post breaks down the change, who it affects, and the exact steps you need to take to keep your app running smoothly.
What Changed
In all supported API versions, the GraphQL mutations draftOrderCreate and draftOrderUpdate now check for the apply_discounts_to_draft_orders permission before accepting any discount‑related fields in DraftOrderInput. If the staff member lacks this permission, the mutation returns a top‑level error with the code ACCESS_DENIED and a null payload. Importantly, this error is not included in the userErrors array, so apps that only inspect userErrors won’t see the failure.
The following actions trigger the permission check:
• Adding a new discount code to discountCodes that isn’t already attached to the draft order
• Setting acceptAutomaticDiscounts to true when the draft order didn’t already accept automatic discounts
For draftOrderCreate, any non‑empty discountCodes array or acceptAutomaticDiscounts:true counts as “adding a discount” because the order is being created from scratch.
Who Is Affected
The change only impacts apps that:
If your app uses an offline access token, a private app credential, or never touches discount fields, you’re safe. The restriction is purely about staff‑member scoped requests that lack the new permission.
Example of the New Error Response
Here’s a typical mutation that tries to add a discount code and turn on automatic discounts:
mutation draftOrderUpdate($id: ID!, $input: DraftOrderInput!) {
draftOrderUpdate(id: $id, input: $input) {
draftOrder {
id
discountCodes
acceptAutomaticDiscounts
}
userErrors {
field
message
}
}
}
With variables:
{
"id": "gid://shopify/DraftOrder/276395349",
"input": {
"discountCodes": ["SUMMER10"],
"acceptAutomaticDiscounts": true
}
}
If the staff user lacks apply_discounts_to_draft_orders, Shopify returns:
{
"errors": [
{
"message": "Access denied for draftOrderUpdate field. Required access: write_draft_orders access scope. Also: The user must have access to manage draft orders.",
"locations": [{"line": 2, "column": 3}],
"path": ["draftOrderUpdate"],
"extensions": {
"code": "ACCESS_DENIED",
"documentation": "https://shopify.dev/api/usage/access-scopes",
"requiredAccess": "write_draft_orders access scope. Also: The user must have access to manage draft orders."
}
}
],
"data": {
"draftOrderUpdate": null
}
}
What You Need to Do
if (response.errors?.some(e => e.extensions?.code === 'ACCESS_DENIED')) {
// Handle missing permission – maybe show a UI prompt
}
Quick Checklist for Developers
Conclusion & Next Steps
Shopify’s new permission requirement tightens control over discount abuse while still giving apps the flexibility they need—provided they ask for the right access. By adjusting error handling and prompting merchants to enable the Apply discounts permission, you’ll keep your draft‑order workflows reliable and compliant. Need help updating your integration? Reach out to our developer support team or drop a comment below—we’re happy to walk you through the changes.
