This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
An event that triggers when an abandoned checkout is recovered (the customer completes the checkout).
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.
function wixEcom_onAbandonedCheckoutRecovered(
event: AbandonedCheckoutRecoveredEvent,
): void;
Information about the abandoned checkout that was recovered.
// 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_onAbandonedCheckoutRecovered(event) {
const abandonedCheckoutId = event.metadata.entityId;
const buyerEmail = event.data.abandonedCheckout.buyerInfo.email;
console.log("Abandoned checkout recovered", event);
}
/* Full event object:
* {
* "entity": {
* "_createdDate": "2021-10-12T00:18:03.045Z",
* "_id": "bea905ef-d7cb-49b9-bce7-19342d3e7ab3",
* "_updatedDate": "2022-06-17T00:18:03.046Z",
* "activities": [
* {
* "createdDate": "2022-09-10T11:49:08.538Z",
* "type": "SCHEDULED"
* },
* {
* "createdDate": "2023-04-30T11:55:01.969Z",
* "type": "EMAIL_SENT"
* }
* ],
* "buyerInfo": {
* "contactId": "77efeff1f-02c3-4a3b-bd7a-2cb4ab8e9a67",
* "email":"mabel@go.com",
* "visitorId":"ea24a72d-4084-4ecd-b36c-541c5d0a82c9"
* },
* "buyerLanguage": "en",
* "cartId": "10cd2c69-20ea-48b8-a015-a943d295392a",
* "checkoutId": "a778cd2c69-20ea-48b8-a015-b56912",
* "checkoutRecoveredDate": "2023-12-30T11:55:01.969Z"
* "checkoutUrl": "http://www.wixapis.com/ecom/v1/abandoned-checkout/7-9665-bb42bf3b8e86/redirect-to-checkout?metasiteId=548f24ea-a663fb0f-9e2e-f431506133"
* "contactDetails": {
* "firstName": "Mabel",
* "lastName": "Goza"
* },
* "conversionCurrency": "EUR",
* "currency":"EUR",
* "totalPrice": {
* "amount": "45",
* "convertedAmount": "45",
* "formattedAmount": "€45.00",
* "formattedConvertedAmount": "€45.00"
* }
* "metadata": {
* "entityId": "c434acce-84f8-4f67-9665-bb42bf448e86",
* "eventTime":"2023-12-13T13:16:11.629738Z",
* "id": "9b1a7beb-6beb-4591-8e3a-280b5972c548",
* "triggeredByAnonymizeRequest": false
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.