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.

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.

Method Declaration
Copy
function onOrderCanceled(event: OrderCanceledEvent): void;
Method Parameters
eventOrderCanceledEventRequired

Order canceled event.

An event when an order is canceled
JavaScript
// Place this code in the events.js file // of your site's Backend section. export function wixStores_onOrderCanceled(event) { const canceledOrderId = event.order._id; } /* Full event object * * { * "order": { * "_id": "d5d43d01-d9a4-4cc2-b257-61184b881447", * "_updatedDate": "2020-05-27T12:20:37.994Z", * "buyerLanguage": "en", * "cartId": "74621781-b3hf-7845-8c9e-09879063da9", * "channelInfo": { * "type": "WEB" * }, * "enteredBy": { * "id": "f6c2c0f9-4e9f-a58d-a02d-9af2497294d9", * "identityType": "MEMBER" * }, * "refunds": [ * { * "id": "0bf46037-de62-7848-af43-3a7f3c28b041", * "dateCreated": "2020-12-14T13:02:04.557Z", * "amount": "50", * "externalRefund": true * } * ], * "billingInfo": { * "address": { * "formatted": "My company name\n235 W 23rd St\nNew York, New York 10011\nUnited States\n+15555555555", * "city": "New York", * "country": "USA", * "addressLine": "235 W 23rd St", * "postalCode": "10011", * "subdivision": "NY" * }, * "firstName": "John", * "lastName": "Doe", * "email": "john.doe@somedomain.com", * "phone": "+15555555555", * "company": "My company name", * "externalTransactionId": "7c03ca74-eaf5-4541-8678-9b857634fdcb", * "paidDate": "2020-05-27T12:20:37.994Z", * "paymentMethod": "VISA", * "paymentGatewayTransactionId": "29A06193U6234935D", * "paymentProviderTransactionId": "7c03ca74-eaf5-4541-8678-9b857634fdcb" * }, * "buyerInfo": { * "id": "f6c2c0f9-4e9f-a58d-a02d-9af2497294d9", * "identityType": "MEMBER", * "firstName": "John", * "lastName": "Doe", * "phone": "+15555555555", * "email": "john.doe@somedomain.com" * }, * "_dateCreated": "2020-05-27T12:20:37.966Z", * "currency": "USD", * "fulfillmentStatus": "CANCELED", * "archived": false, * "activities": [ * { * "type": "ORDER_PLACED", * "timestamp": "2020-05-27T12:20:37.966Z" * } * ], * "number": 10019, * "paymentStatus": "FULLY_REFUNDED", * "shippingInfo": { * "deliveryOption": "Free Shipping", * "estimatedDeliveryTime": "4:30pm", * "shippingRegion": "Domestic", * "shipmentDetails": { * "address": { * "formatted": "235 W 23rd St\nNew York, New York 10011\nUnited States\n5555555555", * "city": "New York", * "country": "USA", * "addressLine": "235 W 23rd St", * "postalCode": "10011", * "subdivision": "NY" * }, * "firstName": "John", * "lastName": "Doe", * "email": "john.doe@somedomain.com", * "phone": "5555555555", * "company": "company name", * "tax": 0, * "discount": 0, * "priceData": { * "price": 0, * "taxIncludedInPrice": false * }, * }, * "pickupDetails": null * }, * "lineItems": [ * { * "index": 1, * "quantity": 1, * "price": 50, * "name": "my product's name", * "translatedName": "Nombre traducido", * "productId": "3fb6a3c8-988b-8755-04bd-5c59ae0b18ea", * "totalPrice": 5, * "lineItemType": "PHYSICAL", * "options": [ * { * "option": "Size", * "selection": "Medium" * } * ], * "customTextFields": [ * { * "title": "Notes for delivery", * "value": "Please leave at front door" * } * ], * "weight": 1.42, * "sku": "36523641234523", * "discount": 0, * "tax": 5, * "taxIncludedInPrice": true, * "priceData": { * "price": "50", * "totalPrice": 50, * "taxIncludedInPrice": true * }, * "mediaItem": { * "altText": "This is a description of the image", * "id": "fac9dc352bf7d54ed0458d64ce41a3ec.jpg", * "src": "wix:image://v1/fac9dc352bf7d54ed0458d64ce41a3ec.jpg/file.jpg#originWidth=1348&originHeight=899", * "type": "IMAGE" * } * } * ], * "totals": { * "discount": 0, * "quantity": 1, * "shipping": 0, * "subtotal": 50, * "tax": 0, * "total": 5, * "weight": 1.42 * }, * "weightUnit": "KG", * "customField": { * "value": "Please call when outside", * "title": "Notes for delivery", * "translatedTitle": "Notas de entrega" * }, * "discount": { * "appliedCoupon": { * "code": "47d259d6-7d1e-4ea5-a75c79ca9bb1", * "couponId": "558b511f-6eb7-82d3-53fca7374dfa", * "name": "Summer sale - Free Shipping" * } * } * } * } * */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?