API Reference
Cancel Order API
The Cancel Order endpoint allows you to programmatically cancel a pending or on-hold order. This will release the reserved stock back into the general pool.
Cancel an Order
PUT
/wp-json/wc/v3/orders/{id}Request Body (JSON)
{
"status": "cancelled"
}Response Schema (JSON)
{
"id": 727,
"parent_id": 0,
"status": "cancelled",
"currency": "ZAR",
"version": "8.5.1",
"date_modified": "2024-01-18T14:40:00",
...
}⚠️
RestrictionsYou can only cancel orders that are in
pending, processing, or on-hold status. Completed orders cannot be cancelled via API and require a refund request.