Search.../

onAbandonedCheckoutRecovered( )

Developer Preview

An event that triggers when an abandoned checkout is recovered (the customer completes the checkout).

Description

The onAbandonedCheckoutCreated() event handler runs when an abandoned checkout is recovered. The AbandonedCheckoutRecoveredEvent object contains information about the abandoned checkout that was recovered, and the event metadata.

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

Syntax

function wixEcom_onAbandonedCheckoutRecovered(event: AbandonedCheckoutRecoveredEvent): void

onAbandonedCheckoutRecovered Parameters

NAME
TYPE
DESCRIPTION
event
Optional
AbandonedCheckoutRecoveredEvent

Information about the abandoned checkout that was recovered.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

An event fired when an abandoned checkout is recovered

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