orderCancel
Requires access scope or
access scope. Also: This action cannot be reversed.
Cancels an order.
Arguments
- Anchor to notifyCustomernotify•
Customer BooleanDefault:false Whether to send a notification to the customer about the order cancellation.
- Anchor to orderIdorder•
Id ID!required The ID of the order to be canceled.
- Anchor to reasonreason•Order
Cancel requiredReason! The reason for canceling the order.
- Anchor to refundrefund•Boolean!required
Indicates whether to refund the amount paid by the customer. Authorized payments will be voided regardless of this setting.
- Anchor to restockrestock•Boolean!required
Whether to restock the inventory committed to the order. For unpaid orders fulfilled from locations that have been deactivated, inventory will not be restocked to the deactivated locations even if this argument is set to true.
- Anchor to staffNotestaff•
Note StringDefault:null A staff-facing note about the order cancellation. This is not visible to the customer.
Anchor to OrderCancelPayload returnsOrderCancelPayload returns
- •
The job that asynchronously cancels the order.
- Anchor to orderCancelUserErrorsorder•
Cancel User Errors [OrderCancel non-nullUser Error!]! The list of errors that occurred from executing the mutation.
- Anchor to userErrorsuser•
Errors The list of errors that occurred from executing the mutation.
Mutation Reference
1mutation orderCancel($notifyCustomer: Boolean, $orderId: ID!, $reason: OrderCancelReason!, $refund: Boolean!, $restock: Boolean!, $staffNote: String) {2 orderCancel(notifyCustomer: $notifyCustomer, orderId: $orderId, reason: $reason, refund: $refund, restock: $restock, staffNote: $staffNote) {3 job {4 # Job fields5 }6 orderCancelUserErrors {7 # OrderCancelUserError fields8 }9 userErrors {10 field11 message12 }13 }14}
Input
1{2 "notifyCustomer": true,3 "orderId": "gid://shopify/<objectName>/10079785100",4 "reason": "CUSTOMER",5 "refund": true,6 "restock": true,7 "staffNote": "<your-staffNote>"8}
{
"notifyCustomer": true,
"orderId": "gid://shopify/<objectName>/10079785100",
"reason": "CUSTOMER",
"refund": true,
"restock": true,
"staffNote": "<your-staffNote>"
}