Search...
cancelOrder( )
Cancels an order.
Description
The cancelOrder()
function returns a Promise that resolves when the specified order is canceled and the order.status
field changes to CANCELED
.
Admin Method
This function requires elevated permissions to run. This function is not universal and runs only on the backend.
Syntax
function cancelOrder(_id: string, options: CancelOrderOptions): Promise<CancelOrderResponse>
cancelOrder Parameters
NAME
TYPE
DESCRIPTION
_id
string
Order ID.
options
Optional
CancelOrderOptions
Returns
Return Type:
Promise<
CancelOrderResponse
>NAME
TYPE
DESCRIPTION
order
Order
Canceled order.
Was this helpful?
cancelOrder example
Copy Code
1import { orders } from 'wix-ecom-backend';23 async function cancelOrder(id, options) {4 try {5 const result = await orders.cancelOrder(id, options);67 return result;8 } catch (error) {9 console.error(error);10 // Handle the error11 }12 }13