onCartDeleted( )


An event that triggers when a cart is deleted.

The onCartDeleted() event handler runs when a cart is deleted. The received CartDeleted object contains event metadata.

Note: Backend events don't work when previewing your site.

Method Declaration
Copy
function wixEcom_onCartDeleted(event: CartDeleted): void;
Method Parameters
eventCartDeleted

Event metadata.

An event fired when a cart is deleted
JavaScript
// Place this code in the events.js file // of your site's Backend section. // Add the file if it doesn't exist. export function wixEcom_onCartDeleted(event) { const cartId = event.metadata.entityId; console.log("Cart deleted", event); } /* Full event object: * * { * "metadata": { * "id": "c3500825-f582-4755-81b3-fa55b8585e5c", * "entityId": "19716650-fd62-4e3a-b98b-7e196d0e88a3", * "eventTime": "2022-07-28T08:36:02.227138Z", * "triggeredByAnonymizeRequest": false * } * } * */
Errors

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

Did this help?