Edit in GitHubLog an issue

cancelOrder mutation

The cancelOrder mutation allows a customer to cancel an order, passing its identifier and a cancellation reason.

A customer can cancel an order only if the following conditions are true:

  • The customer has previously placed the order.
  • The order_cancellation_enabled configuration setting is true.
  • The order has a status of RECEIVED, PENDING, or PROCESSING.

If the customer has been charged for the order, the order is placed in the CLOSED state, and the customer will be issued a refund. Otherwise, the status of the order is set to CANCELED.

The mutation returns an error if the order cannot be cancelled.

Syntax

mutation: {cancelOrder(input: CanceOrderInput!) {CancelOrderOutput}}

Reference

The cancelOrder reference provides detailed information about the types and fields defined in this mutation.

Example usage

The following example cancels order ID 99999999 and includes the reason for its cancellation.

Request:

Copied to your clipboard
mutation {
cancelOrder(
input: {
order_id: "99999999",
reason: "The order was placed by mistake"
}
){
error
order {
status
}
}
}

Response:

Copied to your clipboard
{
"data": {
"cancelOrder": {
"error": null,
"order": {
"status": "Canceled"
}
}
}
}
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.