An event that is triggered when a discount rule is deleted.
The onDiscountRuleDeleted()
event handler runs when a discount rule is deleted. The received DiscountRuleDeleted
object contains event metadata.
Note: Backend events don't work when previewing your site.
function wixEcomDiscounts_onDiscountRuleDeleted(
event: DiscountRuleDeleted,
): void;
Information about the discount rule that was deleted.
export function wixEcomDiscounts_onDiscountRuleDeleted(event) {
const eventId = event.metadata.id;
const entityId = event.entity._id;
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
An event that is triggered when a discount rule is updated.
The onDiscountRuleUpdated()
event handler runs when a discount rule is updated. The received DiscountRuleUpdated
object contains information about the discount rule that was updated.
Note: Backend events don't work when previewing your site.
function wixEcomDiscounts_onDiscountRuleUpdated(
event: DiscountRuleUpdated,
): void;
Information about the discount rule that was updated.
export function wixEcomDiscounts_onDiscountRuleUpdated(event) {
const eventId = event.metadata.id;
const entityId = event.entity._id;
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
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.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Triggered when a back in stock notification request is created.
The onBackInStockNotificationRequestCreated()
event handler runs when a back in stock notification request is created. The received BackInStockNotificationRequestCreated
object contains information about the back in stock notification request that was created and event metadata.
Note: Backend events don't work when previewing your site.
function wixEcom_onBackInStockNotificationRequestCreated(
event: BackInStockNotificationRequestCreated,
): void;
Information about the back in stock notification request that was created.
export function wixEcom_onBackInStockNotificationRequestCreated(event) {
const eventId = event.metadata.id;
const entityId = event.entity._id;
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Triggered when a back in stock notification request is deleted.
The onBackInStockNotificationRequestDeleted()
event handler runs when a back in stock notification request is deleted. The received BackInStockNotificationRequestDeleted
object contains event metadata.
Note: Backend events don't work when previewing your site.
function wixEcom_onBackInStockNotificationRequestDeleted(
event: BackInStockNotificationRequestDeleted,
): void;
Information about the back in stock notification request that was deleted.
export function wixEcom_onBackInStockNotificationRequestDeleted(event) {
const eventId = event.metadata.id;
const entityId = event.entity._id;
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Triggered when a back in stock notification request is updated.
The onBackInStockNotificationRequestUpdated()
event handler runs when a back in stock notification request is updated. The received BackInStockNotificationRequestUpdated
object contains information about the back in stock notification request that was updated and event metadata.
Note: Backend events don't work when previewing your site.
function wixEcom_onBackInStockNotificationRequestUpdated(
event: BackInStockNotificationRequestUpdated,
): void;
Information about the back in stock notification request that was updated.
export function wixEcom_onBackInStockNotificationRequestUpdated(event) {
const eventId = event.metadata.id;
const entityId = event.entity._id;
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
An event that triggers when a new cart is created.
The onCartCreated()
event handler runs when a new cart is created. The received CartCreated
object contains information about the cart that was created and event metadata.
Note: Backend events don't work when previewing your site.
function wixEcom_onCartCreated(event: CartCreated): void;
Information about the cart that was created and event metadata.
// 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_onCartCreated(event) {
const cartSubtotal = event.entity.subtotal.amount;
const cartId = event.entity._id;
const eventId = event.metadata.id;
console.log("Cart created", event);
}
/* Full event object:
*
* {
* "metadata": {
* "id": "ba8e0c2e-dd90-4060-b83c-2590aa075b65",
* "entityId": "1c68f377-4e8f-47c1-bc72-01b18a23cb08",
* "eventTime": "2022-07-04T12:47:21.376865Z",
* "triggeredByAnonymizeRequest": false
* },
* "entity": {
* "_id": "1c68f377-4e8f-47c1-bc72-01b18a23cb08",
* "lineItems": [
* {
* "_id": "00000000-0000-0000-0000-000000000001",
* "quantity": 3,
* "catalogReference": {
* "catalogItemId": "df19c1f7-07d8-a265-42f8-e8dfa824cc6e",
* "appId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
* "options": {
* "variantId": "e62fee23-7878-437a-bf0e-292f17d11cb5"
* }
* },
* "productName": {
* "original": "Shoe",
* "translated": "Shoe"
* },
* "url": "https://example.wixsite.com",
* "price": {
* "amount": "85",
* "convertedAmount": "85",
* "formattedAmount": "$85.00",
* "formattedConvertedAmount": "$85.00"
* },
* "fullPrice": {
* "amount": "85",
* "convertedAmount": "85",
* "formattedAmount": "$85.00",
* "formattedConvertedAmount": "$85.00"
* },
* "priceBeforeDiscounts": {
* "amount": "85",
* "convertedAmount": "85",
* "formattedAmount": "$85.00",
* "formattedConvertedAmount": "$85.00"
* },
* "descriptionLines": [
* {
* "name": {
* "original": "Color",
* "translated": "Color"
* },
* "colorInfo": {
* "original": "Black",
* "translated": "Black",
* "code": "#000"
* },
* "lineType": "UNRECOGNISED"
* }
* ],
* "image": "wix:image://v1/3c76e2_bf235c38610f4d2a905db71095b351cf~mv2.jpg#originWidth=1000&originHeight=1000",
* "availability": {
* "status": "AVAILABLE",
* "quantityAvailable": 30
* },
* "physicalProperties": {
* "sku": "364215376135191",
* "shippable": true
* },
* "couponScopes": [
* {
* "namespace": "stores",
* "group": {
* "name": "collection",
* "entityId": "00000000-000000-000000-000000000001"
* }
* },
* {
* "namespace": "stores",
* "group": {
* "name": "product",
* "entityId": "df19c1f7-07d8-a265-42f8-e8dfa824cc6e"
* }
* }
* ],
* "itemType": {
* "preset": "PHYSICAL"
* },
* "paymentOption": "FULL_PAYMENT_ONLINE"
* }
* ],
* "buyerInfo": {
* "visitorId": "4c7ce95c-9fb3-417d-9f02-b41e82b841f7"
* },
* "currency": "USD",
* "conversionCurrency": "USD",
* "buyerLanguage": "en",
* "siteLanguage": "en",
* "taxIncludedInPrices": false,
* "weightUnit": "KG",
* "subtotal": {
* "amount": "255",
* "convertedAmount": "255",
* "formattedAmount": "$255.00",
* "formattedConvertedAmount": "$255.00"
* },
* "appliedDiscounts": [],
* "inSync": false,
* "_createdDate": "2022-07-04T12:47:21.371Z",
* "_updatedDate": "2022-07-04T12:47:21.371Z"
* }
* }
*
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
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.
function wixEcom_onCartDeleted(event: CartDeleted): void;
Event metadata.
// 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
* }
* }
*
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.