See all services → Shopify Plus Partner
Action Required Developer

Handle Draft Order Discount Permission Errors in GraphQL

Draft order mutations now return a top-level ACCESS_DENIED error when a staff member without the apply discounts permission adds a discount. Apps that check only userErrors will record a save that never happened.

Executive summary

What changed

Across all supported API versions, draftOrderCreate and draftOrderUpdate now return an ACCESS_DENIED error when a request running as a staff member without the apply_discounts_to_draft_orders permission adds a discount. Adding a discount code the draft order does not already hold counts, as does setting automatic discounts to true where they were off. On creation, any non-empty discount code list or automatic discounts set to true qualifies, since there is no prior state to compare against.

The failure mode is the important detail. The mutation does not save the draft order, the payload comes back null, and the error appears in the top-level errors array rather than in userErrors. Keeping or removing existing discounts still works, and requests that do not act as a staff member are unaffected.

Why it matters

This is a small permission change with a disproportionate failure surface, because most Shopify app code treats an empty userErrors array as success. Under that pattern the app reports a saved quote, no draft order exists, and the discrepancy surfaces when the customer asks where their quote went. On a sales desk handling dozens of quotes a day, a silent null costs far more than a visible error.

The exposure concentrates in B2B workflows. Negotiated pricing on Shopify often runs through draft orders as quotes created by an app acting for a sales rep, with discount codes carrying the agreed concession. If your wholesale and B2B setup depends on reps discounting through tooling rather than the admin, audit the staff permissions behind it before the first support ticket.

This tightening is arguably overdue. A permission that governed discounting in the admin but not through the API was never a coherent control, particularly where discount authority is deliberately limited across a large or seasonal sales team.

Role-specific impact

Use-case example

Real-world scenario

An industrial supplier runs quoting through a private app where each rep authenticates with their own staff account, applying an agreed discount code before sending a quote. Two reps hired last quarter were provisioned without the apply discounts permission, which never mattered because they worked only in the app. After this change their submissions return null with an ACCESS_DENIED error the app does not inspect, so the interface confirms a save that never happened. Roughly 15 quotes are lost over four days before a customer follow-up exposes it. Top-level error handling and two corrected permission sets close the gap, but the detection delay is the real cost.

Implementation checklist

  1. Locate every call site for draftOrderCreate and draftOrderUpdate across your apps and internal services.
  2. Confirm each one reads the top-level errors array in addition to userErrors.
  3. Treat a null mutation payload as a failure and surface it to the user rather than reporting a successful save.
  4. Identify which staff accounts your apps act as, including service accounts shared across a team.
  5. Grant the Apply discounts permission under Draft orders to those accounts where discounting is intended.
  6. Test both paths in a development store: adding a discount with the permission, and without it.
  7. Alert on the ACCESS_DENIED case so a permission regression is visible within hours, not days.

FAQ

Q: Does this affect apps using an offline access token?

A: No. The restriction applies only to requests acting as a staff member. Requests using offline tokens behave as they did before.

Q: Can an app still update a draft order that already carries a discount?

A: Yes. Keeping or removing existing discounts is unaffected. Only adding a discount code the order does not have, or switching on automatic discounts where they were off, triggers the error.

Resources

draftOrderUpdate mutation reference

Need guidance? Talk to Makro.