Search...
onOrderCanceled( )
Deprecated.
This event will continue to work until September 4, 2024, but a newer version is available at
wix-ecom-backend.Events.onOrderCanceled()
.
We recommend you migrate to the new Wix eCommerce APIs as soon as possible.
Description
An event that fires when an order is canceled.
The onOrderCanceled()
event handler runs when an order is canceled. For example, when an order is canceled in the site's Dashboard.
Note: Backend events don't work when previewing your site.
Syntax
function onOrderCanceled(event: OrderCanceledEvent): void
onOrderCanceled Parameters
NAME
TYPE
DESCRIPTION
event
OrderCanceledEvent
Order canceled event.
Returns
This function does not return anything.
Return Type:
void
Was this helpful?
An event when an order is canceled
Copy Code
1// Place this code in the events.js file2// of your site's Backend section.34export function wixStores_onOrderCanceled(event) {5 const canceledOrderId = event.order._id;6}78/* Full event object9 *10 * {11 * "order": {12 * "_id": "d5d43d01-d9a4-4cc2-b257-61184b881447",13 * "_updatedDate": "2020-05-27T12:20:37.994Z",14 * "buyerLanguage": "en",15 * "cartId": "74621781-b3hf-7845-8c9e-09879063da9",16 * "channelInfo": {17 * "type": "WEB"18 * },19 * "enteredBy": {20 * "id": "f6c2c0f9-4e9f-a58d-a02d-9af2497294d9",21 * "identityType": "MEMBER"22 * },23 * "refunds": [24 * {25 * "id": "0bf46037-de62-7848-af43-3a7f3c28b041",26 * "dateCreated": "2020-12-14T13:02:04.557Z",27 * "amount": "50",28 * "externalRefund": true29 * }30 * ],31 * "billingInfo": {32 * "address": {33 * "formatted": "My company name\n235 W 23rd St\nNew York, New York 10011\nUnited States\n+15555555555",34 * "city": "New York",35 * "country": "USA",36 * "addressLine": "235 W 23rd St",37 * "postalCode": "10011",38 * "subdivision": "NY"39 * },40 * "firstName": "John",41 * "lastName": "Doe",42 * "email": "john.doe@somedomain.com",43 * "phone": "+15555555555",44 * "company": "My company name",45 * "externalTransactionId": "7c03ca74-eaf5-4541-8678-9b857634fdcb",46 * "paidDate": "2020-05-27T12:20:37.994Z",47 * "paymentMethod": "VISA",48 * "paymentGatewayTransactionId": "29A06193U6234935D",49 * "paymentProviderTransactionId": "7c03ca74-eaf5-4541-8678-9b857634fdcb"50 * },51 * "buyerInfo": {52 * "id": "f6c2c0f9-4e9f-a58d-a02d-9af2497294d9",53 * "identityType": "MEMBER",54 * "firstName": "John",55 * "lastName": "Doe",56 * "phone": "+15555555555",57 * "email": "john.doe@somedomain.com"58 * },59 * "_dateCreated": "2020-05-27T12:20:37.966Z",60 * "currency": "USD",61 * "fulfillmentStatus": "CANCELED",62 * "archived": false,63 * "activities": [64 * {65 * "type": "ORDER_PLACED",66 * "timestamp": "2020-05-27T12:20:37.966Z"67 * }68 * ],69 * "number": 10019,70 * "paymentStatus": "FULLY_REFUNDED",71 * "shippingInfo": {72 * "deliveryOption": "Free Shipping",73 * "estimatedDeliveryTime": "4:30pm",74 * "shippingRegion": "Domestic",75 * "shipmentDetails": {76 * "address": {77 * "formatted": "235 W 23rd St\nNew York, New York 10011\nUnited States\n5555555555",78 * "city": "New York",79 * "country": "USA",80 * "addressLine": "235 W 23rd St",81 * "postalCode": "10011",82 * "subdivision": "NY"83 * },84 * "firstName": "John",85 * "lastName": "Doe",86 * "email": "john.doe@somedomain.com",87 * "phone": "5555555555",88 * "company": "company name",89 * "tax": 0,90 * "discount": 0,91 * "priceData": {92 * "price": 0,93 * "taxIncludedInPrice": false94 * },95 * },96 * "pickupDetails": null97 * },98 * "lineItems": [99 * {100 * "index": 1,101 * "quantity": 1,102 * "price": 50,103 * "name": "my product's name",104 * "translatedName": "Nombre traducido",105 * "productId": "3fb6a3c8-988b-8755-04bd-5c59ae0b18ea",106 * "totalPrice": 5,107 * "lineItemType": "PHYSICAL",108 * "options": [109 * {110 * "option": "Size",111 * "selection": "Medium"112 * }113 * ],114 * "customTextFields": [115 * {116 * "title": "Notes for delivery",117 * "value": "Please leave at front door"118 * }119 * ],120 * "weight": 1.42,121 * "sku": "36523641234523",122 * "discount": 0,123 * "tax": 5,124 * "taxIncludedInPrice": true,125 * "priceData": {126 * "price": "50",127 * "totalPrice": 50,128 * "taxIncludedInPrice": true129 * },130 * "mediaItem": {131 * "altText": "This is a description of the image",132 * "id": "fac9dc352bf7d54ed0458d64ce41a3ec.jpg",133 * "src": "wix:image://v1/fac9dc352bf7d54ed0458d64ce41a3ec.jpg/file.jpg#originWidth=1348&originHeight=899",134 * "type": "IMAGE"135 * }136 * }137 * ],138 * "totals": {139 * "discount": 0,140 * "quantity": 1,141 * "shipping": 0,142 * "subtotal": 50,143 * "tax": 0,144 * "total": 5,145 * "weight": 1.42146 * },147 * "weightUnit": "KG",148 * "customField": {149 * "value": "Please call when outside",150 * "title": "Notes for delivery",151 * "translatedTitle": "Notas de entrega"152 * },153 * "discount": {154 * "appliedCoupon": {155 * "code": "47d259d6-7d1e-4ea5-a75c79ca9bb1",156 * "couponId": "558b511f-6eb7-82d3-53fca7374dfa",157 * "name": "Summer sale - Free Shipping"158 * }159 * }160 * }161 * }162 *163 */