Search.../

onCartDeleted( )

An event that triggers when a cart is deleted.

Description

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.

Syntax

function wixEcom_onCartDeleted(event: CartDeleted): void

onCartDeleted Parameters

NAME
TYPE
DESCRIPTION
event
Optional
CartDeleted

Event metadata.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

An event fired when a cart is deleted

Copy Code
1// Place this code in the events.js file
2// of your site's Backend section.
3// Add the file if it doesn't exist.
4
5export function wixEcom_onCartDeleted(event) {
6 const cartId = event.metadata.entityId;
7 console.log('Cart deleted', event);
8}
9
10/* Full event object:
11 *
12 * {
13 * "metadata": {
14 * "id": "c3500825-f582-4755-81b3-fa55b8585e5c",
15 * "entityId": "19716650-fd62-4e3a-b98b-7e196d0e88a3",
16 * "eventTime": "2022-07-28T08:36:02.227138Z",
17 * "triggeredByAnonymizeRequest": false
18 * }
19 * }
20 *
21 */