Search.../

onAbandonedCheckoutCreated( )

Developer Preview

An event that triggers when an abandoned checkout is created.

Description

The onAbandonedCheckoutCreated() event handler runs when a new abandoned checkout is created. The AbandonedCheckoutCreated object contains information about the abandoned checkout that was created, and the event metadata.

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

Syntax

function wixEcom_onAbandonedCheckoutCreated(event: AbandonedCheckoutCreated): void

onAbandonedCheckoutCreated Parameters

NAME
TYPE
DESCRIPTION
event
Optional
AbandonedCheckoutCreated

Information about the abandoned checkout that was created.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

An event fired when an abandoned checkout is created

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_onAbandonedCheckoutCreated(event) {
6 const abandonedCheckoutId = event.metadata.entityId;
7 const buyerEmail = event.entity.buyerInfo.email;
8 console.log('Abandoned checkout created', event);
9}
10
11/* Full event object:
12 * {
13 * "entity": {
14 * "_createdDate": "2022-02-12T00:18:03.045Z",
15 * "_id": "bea905ef-d7cb-49b9-bce7-19342d3e7ab3",
16 * "_updatedDate": "2023-02-12T00:18:03.046Z",
17 * "activities": [
18 * {
19 * "createdDate": "2023-04-30T11:49:08.538Z",
20 * "type": "SCHEDULED"
21 * },
22 * {
23 * "createdDate": "2023-04-30T11:55:01.969Z",
24 * "type": "EMAIL_SENT"
25 * }
26 * ],
27 * "buyerInfo": {
28 * "contactId": "5efeff1f-02c3-4a3b-bd7a-2cb4ab8e9a67",
29 * "email":"jessicajones@cartoons.com",
30 * "visitorId":"ea24a72d-403334ecd-b36c-541c5d0a82c9"
31 * },
32 * "buyerLanguage": "en",
33 * "cartId": "10cd2c69-20ea-48b8-a015-a943d295392a",
34 * "checkoutId": "",
35 * "checkoutUrl": "http://www.wixapis.com/ecom/v1/abandoned-checkout/7-9665-bb42bf3b8e86/redirect-to-checkout?metasiteId=548f24ea-a663fb0f-9e2e-f431506133"
36 * "contactDetails": {
37 * "firstName": "Jessica",
38 * "lastName": "Jones"
39 * },
40 * "conversionCurrency": "EUR",
41 * "currency":"EUR",
42 * "totalPrice": {
43 * "amount": "45",
44 * "convertedAmount": "45",
45 * "formattedAmount": "€45.00",
46 * "formattedConvertedAmount": "€45.00"
47 * }
48 * "metadata": {
49 * "entityId": "a434acce-84f8-4f67-9665-bb42bf448e86",
50 * "eventTime":"2023-12-13T13:16:11.629738Z",
51 * "id": "8b1a7beb-6beb-4591-8e3a-280b5972c548",
52 * "triggeredByAnonymizeRequest": false
53 * }
54 * }
55 */