write_draft_orders. The acting staff member also needs the apply_discounts_to_draft_orders permission. Inspect the top-level GraphQL errors array for ACCESS_DENIED; checking only mutation userErrors will miss this failure.On this page
Why the same integration can work for one staff member and fail for another
Shopify tightened authorization for draftOrderCreate and draftOrderUpdate across all supported API versions on November 18, 2026. The condition is specific: the app is acting as a staff member and the mutation is adding a discount. The app’s OAuth scopes and the staff member’s permissions are separate gates. A successful app installation does not grant every employee permission to apply draft-order discounts.
Adding a previously absent code to discountCodes, or changing acceptAutomaticDiscounts from false to true, triggers the check. On creation, any nonempty discount-code list or acceptAutomaticDiscounts: true counts as adding a discount. Keeping or removing existing discounts is not subject to this new add-discount restriction. Offline-token requests that do not act as staff are not affected by this particular change.
What to fix in your app
- Log the request’s authentication context without logging tokens. Determine whether it runs as a staff member or via an offline token.
- Check the staff role’s Draft orders permission for applying discounts. Have a merchant administrator grant that permission only where appropriate.
- Handle GraphQL transport/top-level errors before reading the mutation payload. A denied request returns
data.draftOrderCreateordata.draftOrderUpdateasnull. - Do not retry permission failures as transient errors or assume the draft was saved. Report an actionable message to the operator.
- Keep the normal
userErrorshandling for field and business-rule validation after checking top-level errors.
Example: handle both error channels
const response = await admin.graphql(MUTATION, { variables });
const result = await response.json();
const denied = (result.errors ?? []).some(
error => error.extensions?.code === 'ACCESS_DENIED'
);
if (denied) {
throw new Error('Staff permission required to apply draft-order discounts');
}
if (result.errors?.length) {
throw new Error('Draft order mutation failed at GraphQL level');
}
const payload = result.data?.draftOrderUpdate;
if (!payload) throw new Error('Draft order was not saved');
if (payload.userErrors?.length) {
throw new Error(payload.userErrors.map(e => e.message).join('; '));
}
This is an error-handling pattern, not a complete app route. Keep the specific mutation name consistent with your operation and surface the safe, actionable message to the user.
userErrors, so the draft order must have saved.” GraphQL responses can carry top-level errors and a null mutation payload. HTTP success alone is not proof of a successful mutation.- Create a test staff role with draft-order access but without Apply discounts permission; run a discount-adding mutation under that staff context.
- Confirm
errors[].extensions.codeisACCESS_DENIED, the mutation payload is null, and no draft change was saved. - Repeat with the proper permission and confirm the discount is applied.
- Test a mutation that does not add discounts, then one that only removes an existing discount.
- Run a controlled offline-token request if your integration supports it and compare behavior.
- Verify the app’s UI displays an actionable permission message rather than silently succeeding or retrying.

