Skip to main content

cancelPurchaseOrder

Requires permission purchase:purchase_order:update.

Cancels a purchase order. It is allowed from DRAFT, SUBMITTED, APPROVED and PARTIALLY_RECEIVED. With nothing received the order becomes CANCELLED. Once goods are received, only the quantity not yet received is cancelled: the received goods and their receipts stay, the order ends RECEIVED (short closed), no further receipt can be posted, and a reason is required. A RECEIVED, CANCELLED or CLOSED order cannot be cancelled again. Needs the purchase orders feature on your plan.

Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.

Example:

mutation CancelPurchaseOrder($id: ID!) {
cancelPurchaseOrder(id: $id) {
id
orderNumber
supplierCode
trackingCode
creatorName
projectName
items {
id
productName
uomName
variantName
createdAt
canceledQuantity
}
}
}

Variables:

{
"id": "id"
}

Response:

{
"data": {
"cancelPurchaseOrder": {
"id": "id",
"orderNumber": "string",
"supplierCode": "string",
"trackingCode": "string",
"creatorName": "string",
"projectName": "string",
"items": [
{
"id": "id",
"productName": "string",
"uomName": "string",
"variantName": "string",
"createdAt": "2025-01-15T00:00:00Z",
"canceledQuantity": 0
}
]
}
}
}
cancelPurchaseOrder(
id: ID!
reason: String
): PurchaseOrder!

Arguments​

cancelPurchaseOrder.id ● ID! non-null scalar​

The ID of the purchase order.

cancelPurchaseOrder.reason ● String scalar​

Why the purchase order is cancelled.

Type​

PurchaseOrder object​

A purchase order raised with a supplier.