onCollectionUpdated( )


An event that fires when a product collection is updated.

The onCollectionUpdated() event handler runs when a product collection is updated in a store.

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

Method Declaration
Copy
function onCollectionUpdated(event: CollectionUpdatedEvent): void;
Method Parameters
eventCollectionUpdatedEventRequired

Information about the product collection that was updated.

An event when a product collection is updated
JavaScript
// Place this code in the events.js file // of your site's Backend section. export function wixStores_onCollectionUpdated(event) { let collectionId = event.collectionId; let firstUpdatedField = event.updateFields[0]; } /* Full event object: * * { * "collectionId": "1a2d7e83-4bef-31d5-09e1-3326ee271c09", * "updatedFields": [ * "name", * "media" * ] * } * */
Did this help?

onFulfillmentCreated( )


Deprecated. This event will continue to work until September 4, 2024, but a newer version is available at wix-ecom-backend.Events.onFulfillmentsUpdated().

We recommend you migrate to the new Wix eCommerce APIs as soon as possible.

An event that fires when an order fulfillment is created.

The onFulfillmentCreated() event handler runs when one of the following occurs:

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

Method Declaration
Copy
function onFulfillmentCreated(event: FulfillmentCreatedEvent): void;
Method Parameters
eventFulfillmentCreatedEventRequired

Information about a fulfillment that was created.

An event when a fulfillment is created
JavaScript
// Place this code in the events.js file // of your site's Backend section. export function wixStores_onFulfillmentCreated(event) { const orderId = event.orderId; const fulfillmentId = event.fulfillmentId; const trackingNumber = event.trackingInfo.trackingNumber; } /* Full event object: * * { * "orderId": "2c6ce6e5-8b40-4d2c-882a-edeb30fb3ec2", * "fulfillmentId": "4afd9175-b3c5-41b9-b3cc-e65b7544e84b", * "dateCreated": "2020-02-22T10:41:32.487Z", * "buyerInfo": { * "id": "a158c93a-2f1e-4e86-a38f-475931a337ce", * "identityType": "MEMBER", * "firstName": "John", * "lastName": "Doe", * "phone": "5555555555", * "email": "john@doe.com" * }, * "fulfillmentStatus": "FULFILLED", * "trackingInfo": { * "trackingNumber": "1234", * "shippingProvider": "fedex", * "trackingLink": "https://www.fedex.com/apps/fedextrack/?action=track&trackingnumber=1234" * } * } * */
Did this help?

onFulfillmentDeleted( )


Deprecated. This event will continue to work until September 4, 2024, but a newer version is available at wix-ecom-backend.Events.onFulfillmentsUpdated().

We recommend you migrate to the new Wix eCommerce APIs as soon as possible.

An event that fires when an order fulfillment is deleted.

The onFulfillmentDeleted() event handler runs when the deleteFulfillment() function is called.

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

Method Declaration
Copy
function onFulfillmentDeleted(event: FulfillmentDeletedEvent): void;
Method Parameters
eventFulfillmentDeletedEventRequired

Information about a fulfillment that was deleted.

An event when a fulfillment is deleted
JavaScript
// Place this code in the events.js file // of your site's Backend section. export function wixStores_onFulfillmentDeleted(event) { let orderId = event.orderId; let fulfillmentId = event.fulfillmentId; } /* Full event object: * * { * "orderId": "2c6ce6e5-8b40-4d2c-882a-edeb30fb3ec2", * "fulfillmentId": "4afd9175-b3c5-41b9-b3cc-e65b7544e84b", * "fulfillmentStatus": "NOT_FULFILLED" * } * */
Did this help?

onFulfillmentUpdated( )


Deprecated. This event will continue to work until September 4, 2024, but a newer version is available at wix-ecom-backend.Events.onFulfillmentsUpdated().

We recommend you migrate to the new Wix eCommerce APIs as soon as possible.

An event that fires when an order fulfillment is updated.

The onFulfillmentUpdated() event handler runs when one of the following occurs:

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

Method Declaration
Copy
function onFulfillmentUpdated(event: FulfillmentUpdatedEvent): void;
Method Parameters
eventFulfillmentUpdatedEventRequired

Information about a fulfillment that was updated.

An event when a fulfillment is updated
JavaScript
// Place this code in the events.js file // of your site's Backend section. export function wixStores_onFulfillmentUpdated(event) { let orderId = event.orderId; let fulfillmentId = event.fulfillmentId; let trackingNumber = event.trackingInfo.trackingNumber; } /* Full event object: * * { * "orderId": "2c6ce6e5-8b40-4d2c-882a-edeb30fb3ec2", * "fulfillmentId": "4afd9175-b3c5-41b9-b3cc-e65b7544e84b", * "trackingInfo": { * "trackingNumber": "6789", * "shippingProvider": "Some other provider", * "trackingLink": "https://www.fedex.com/apps/fedextrack/?action=track&trackingnumber=6789" * } * } * */
Did this help?

onInventoryItemUpdated( )


An event that fires when an inventory item's information is updated.

The onInventoryItemUpdated() event handler runs when information for an inventory item is updated in a store.

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

Method Declaration
Copy
function onInventoryItemUpdated(event: InventoryItemUpdatedEvent): void;
Method Parameters
eventInventoryItemUpdatedEventRequired

Information about the updated inventory item.

An event when an inventory item's information is updated
JavaScript
// Place this code in the events.js file // of your site's Backend section. export function wixStores_onInventoryItemUpdated(event) { let inventoryItemId = event.inventoryItemId; } /* Full event object: * * { * "inventoryItemId":"70170fa0-6ae1-ea9c-46e8-775207d7babc", * "externalId":"8fe8f05f-951e-1563-b917-88adf8284543", * "trackInventory":true * } * */
Did this help?

onInventoryVariantUpdated( )


An event that fires when the inventory information of a product variant is updated.

The onInventoryVariantUpdated() event handler runs when inventory information for a product variant is updated in a store.

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

Method Declaration
Copy
function onInventoryVariantUpdated(event: InventoryVariantUpdatedEvent): void;
Method Parameters
eventInventoryVariantUpdatedEventRequired

Information about the updated variant.

An event when product variant inventory information is updated
JavaScript
// Place this code in the events.js file // of your site's Backend section. export function wixStores_onInventoryVariantUpdated(event) { let inventoryItemId = event.inventoryItemId; let firstVariant = event.variants[0]; let firstNewQuantity = firstVariant.newValue.quantity; } /* Full event object: * * { * "variants": [ * { * "oldValue": { * "inStock": true, * "quantity": 10 * }, * "newValue": { * "inStock": true, * "quantity": 50 * }, * "id": "00000000-0000-0000-0000-000000000000" * } * ], * "externalId": "8fe8f05f-951e-1563-b917-88adf8284543", * "inventoryItemId": "70170fa0-6ae1-ea9c-46e8-775207d7babc" * } * */
Did this help?

onNewOrder( )


Deprecated. This event will continue to work until September 4, 2024, but a newer version is available at wix-ecom-backend.Events.onOrderApproved().

We recommend you migrate to the new Wix eCommerce APIs as soon as possible.

An event that fires when a new order is placed.

The onNewOrder() event handler runs when a new order is placed in your site's store. The received NewOrderEvent object contains information about the new order that was placed.

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

Method Declaration
Copy
function onNewOrder(event: NewOrderEvent): void;
Method Parameters
eventNewOrderEventRequired

The order data.

An event when a new order is placed
JavaScript
// Place this code in the events.js file // of your site's Backend section. import wixData from "wix-data"; export function wixStores_onNewOrder(event) { const newOrderId = event.orderId; const newOrderBuyerInfo = event.buyerInfo; // Get the new order's line items from the Stores/Orders collection const orderLineItems = wixData .get("Stores/Orders", newOrderId) .then((results) => { return results.lineItems; }) .catch((error) => { // Order not found in the Stores/Orders collection console.error(error); }); } /* Full event object: * * { * "orderId": "2cd413bd-ddea-4101-b122-e8b146fec05f", * "number": "10005", * "dateCreated": "2018-08-05T12:33:18.938Z", * "buyerInfo": { * "id": "6g004532-732d-829f-5kf9-f9rk42afpla04m", * "identityType": "MEMBER", * "email": "janedoe@gmail.com", * "firstName": "Jane", * "lastName": "Doe", * "phone": "5555555555" * }, * "currency": "USD", * "weightUnit": "LB", * "totals": { * "subtotal": 99.99, * "shipping": 4.99, * "tax": 8.87, * "discount": 9.99, * "total": 103.86, * "weight": 1.37, * "quantity": 2 * }, * "paymentStatus": "PAID", * "fulfillmentStatus": "FULFILLED", * "billingInfo": { * "paymentMethod": "VISA", * "externalTransactionId": "7c03ca74-eaf5-4541-8678-9b857634fdcb", * "paymentGatewayTransactionId": "29A06193U6234935D", * "paymentProviderTransactionId": "7c03ca74-eaf5-4541-8678-9b857634fdcb" * "address": { * "fullName": { * "firstName": "Jane", * "lastName": "Doe" * }, * "country": "US", * "subdivision": "US-NY", * "city": "New York", * "zipCode": "11215", * "phone": "0555555555", * "email": "janedoe@gmail.com", * "addressLine1": "525 5th Avenue" * } * }, * // The following field is only present when * // the order is a subscription * "subscriptionInfo": { * "id": "6b320feb-ddde-45be-950b-8ed277033579", * "cycleNumber": 1, * "subscriptionSettings": { * "frequency": "MONTH", * "autoRenewal": false, * "billingCycles": 3 * }, * "subscriptionOptionInfo": { * "id": "17c145c2-5d23-42c3-ac0a-e579e99c67fd", * "title": "Coffee of the month", * "description": "Monthly Coffee Sub" * } * } * } * */
Did this help?

onOrderCanceled( )


Deprecated. This event will continue to work until September 4, 2024, but a newer version is available at wix-ecom-backend.Events.onOrderCanceled().

We recommend you migrate to the new Wix eCommerce APIs as soon as possible.

An event that fires when an order is canceled.

The onOrderCanceled() event handler runs when an order is canceled. For example, when an order is canceled in the site's Dashboard.

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

Method Declaration
Copy
function onOrderCanceled(event: OrderCanceledEvent): void;
Method Parameters
eventOrderCanceledEventRequired

Order canceled event.

An event when an order is canceled
JavaScript
// Place this code in the events.js file // of your site's Backend section. export function wixStores_onOrderCanceled(event) { const canceledOrderId = event.order._id; } /* Full event object * * { * "order": { * "_id": "d5d43d01-d9a4-4cc2-b257-61184b881447", * "_updatedDate": "2020-05-27T12:20:37.994Z", * "buyerLanguage": "en", * "cartId": "74621781-b3hf-7845-8c9e-09879063da9", * "channelInfo": { * "type": "WEB" * }, * "enteredBy": { * "id": "f6c2c0f9-4e9f-a58d-a02d-9af2497294d9", * "identityType": "MEMBER" * }, * "refunds": [ * { * "id": "0bf46037-de62-7848-af43-3a7f3c28b041", * "dateCreated": "2020-12-14T13:02:04.557Z", * "amount": "50", * "externalRefund": true * } * ], * "billingInfo": { * "address": { * "formatted": "My company name\n235 W 23rd St\nNew York, New York 10011\nUnited States\n+15555555555", * "city": "New York", * "country": "USA", * "addressLine": "235 W 23rd St", * "postalCode": "10011", * "subdivision": "NY" * }, * "firstName": "John", * "lastName": "Doe", * "email": "john.doe@somedomain.com", * "phone": "+15555555555", * "company": "My company name", * "externalTransactionId": "7c03ca74-eaf5-4541-8678-9b857634fdcb", * "paidDate": "2020-05-27T12:20:37.994Z", * "paymentMethod": "VISA", * "paymentGatewayTransactionId": "29A06193U6234935D", * "paymentProviderTransactionId": "7c03ca74-eaf5-4541-8678-9b857634fdcb" * }, * "buyerInfo": { * "id": "f6c2c0f9-4e9f-a58d-a02d-9af2497294d9", * "identityType": "MEMBER", * "firstName": "John", * "lastName": "Doe", * "phone": "+15555555555", * "email": "john.doe@somedomain.com" * }, * "_dateCreated": "2020-05-27T12:20:37.966Z", * "currency": "USD", * "fulfillmentStatus": "CANCELED", * "archived": false, * "activities": [ * { * "type": "ORDER_PLACED", * "timestamp": "2020-05-27T12:20:37.966Z" * } * ], * "number": 10019, * "paymentStatus": "FULLY_REFUNDED", * "shippingInfo": { * "deliveryOption": "Free Shipping", * "estimatedDeliveryTime": "4:30pm", * "shippingRegion": "Domestic", * "shipmentDetails": { * "address": { * "formatted": "235 W 23rd St\nNew York, New York 10011\nUnited States\n5555555555", * "city": "New York", * "country": "USA", * "addressLine": "235 W 23rd St", * "postalCode": "10011", * "subdivision": "NY" * }, * "firstName": "John", * "lastName": "Doe", * "email": "john.doe@somedomain.com", * "phone": "5555555555", * "company": "company name", * "tax": 0, * "discount": 0, * "priceData": { * "price": 0, * "taxIncludedInPrice": false * }, * }, * "pickupDetails": null * }, * "lineItems": [ * { * "index": 1, * "quantity": 1, * "price": 50, * "name": "my product's name", * "translatedName": "Nombre traducido", * "productId": "3fb6a3c8-988b-8755-04bd-5c59ae0b18ea", * "totalPrice": 5, * "lineItemType": "PHYSICAL", * "options": [ * { * "option": "Size", * "selection": "Medium" * } * ], * "customTextFields": [ * { * "title": "Notes for delivery", * "value": "Please leave at front door" * } * ], * "weight": 1.42, * "sku": "36523641234523", * "discount": 0, * "tax": 5, * "taxIncludedInPrice": true, * "priceData": { * "price": "50", * "totalPrice": 50, * "taxIncludedInPrice": true * }, * "mediaItem": { * "altText": "This is a description of the image", * "id": "fac9dc352bf7d54ed0458d64ce41a3ec.jpg", * "src": "wix:image://v1/fac9dc352bf7d54ed0458d64ce41a3ec.jpg/file.jpg#originWidth=1348&originHeight=899", * "type": "IMAGE" * } * } * ], * "totals": { * "discount": 0, * "quantity": 1, * "shipping": 0, * "subtotal": 50, * "tax": 0, * "total": 5, * "weight": 1.42 * }, * "weightUnit": "KG", * "customField": { * "value": "Please call when outside", * "title": "Notes for delivery", * "translatedTitle": "Notas de entrega" * }, * "discount": { * "appliedCoupon": { * "code": "47d259d6-7d1e-4ea5-a75c79ca9bb1", * "couponId": "558b511f-6eb7-82d3-53fca7374dfa", * "name": "Summer sale - Free Shipping" * } * } * } * } * */
Did this help?

onOrderPaid( )


Deprecated. This event will continue to work until September 4, 2024, but a newer version is available at wix-ecom-backend.Events.onOrderPaymentStatusUpdated().

We recommend you migrate to the new Wix eCommerce APIs as soon as possible.

An event that fires when an order is marked as paid.

The onOrderPaid() event handler runs when an order is paid either via customer checkout, or when marked as paid on your site's Dashboard.

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

Method Declaration
Copy
function onOrderPaid(event: Order): void;
Method Parameters
eventOrderRequired

Paid order data.

An event when an order is paid
JavaScript
// Place this code in the events.js file // of your site's Backend section. export function wixStores_onOrderPaid(event) { const paidOrderId = event._id; } /* Full event object * * { * "_id": "d5d43d01-d9a4-4cc2-b257-61184b881447", * "_updatedDate": "2020-05-27T12:20:37.994Z", * "buyerLanguage": "en", * "cartId": "74621781-b3hf-7845-8c9e-09879063da9", * "channelInfo": { * "type": "WEB" * }, * "enteredBy": { * "id": "f6c2c0f9-4e9f-a58d-a02d-9af2497294d9", * "identityType": "MEMBER" * }, * "billingInfo": { * "address": { * "formatted": "My company name\n235 W 23rd St\nNew York, New York 10011\nUnited States\n+15555555555", * "city": "New York", * "country": "USA", * "addressLine": "235 W 23rd St", * "postalCode": "10011", * "subdivision": "NY" * }, * "firstName": "Jane", * "lastName": "Doe", * "email": "janedoe@gmail.com", * "phone": "+15555555555", * "company": "My company name", * "paidDate": "2020-05-27T12:20:37.994Z", * "paymentMethod": "VISA", * "externalTransactionId": "7c03ca74-eaf5-4541-8678-9b857634fdcb", * "paymentGatewayTransactionId": "29A06193U6234935D", * "paymentProviderTransactionId": "7c03ca74-eaf5-4541-8678-9b857634fdcb" * }, * "buyerInfo": { * "id": "f6c2c0f9-4e9f-a58d-a02d-9af2497294d9", * "identityType": "MEMBER", * "firstName": "Jane", * "lastName": "Doe", * "phone": "+15555555555", * "email": "janedoe@gmail.com" * }, * "_dateCreated": "2020-05-27T12:20:37.966Z", * "currency": "ILS", * "fulfillmentStatus": "NOT_FULFILLED", * "archived": false, * "activities": [ * { * "type": "ORDER_PLACED", * "timestamp": "2020-05-27T12:20:37.966Z" * }, * { * "type": "ORDER_PAID", * "timestamp": "2020-05-27T12:20:37.994Z" * } * ], * "number": 10019, * "paymentStatus": "PAID", * "shippingInfo": { * "deliveryOption": "Free Shipping", * "estimatedDeliveryTime": "4:30pm", * "shippingRegion": "Domestic", * "shipmentDetails": { * "address": { * "formatted": "company name\n235 W 23rd St\nNew York, New York 10011\nUnited States\n5555555555", * "city": "New York", * "country": "USA", * "addressLine": "235 W 23rd St", * "postalCode": "10011", * "subdivision": "NY" * }, * "firstName": "Jane", * "lastName": "Doe", * "email": "janedoe@gmail.com", * "phone": "5555555555", * "company": "company name", * "tax": 0, * "discount": 0, * "priceData": null * }, * "pickupDetails": null * }, * "lineItems": [ * { * "index": 1, * "quantity": 1, * "price": 5, * "name": "my product's name", * "translatedName": "Nombre traducido", * "productId": "3fb6a3c8-988b-8755-04bd-5c59ae0b18ea", * "totalPrice": 5, * "lineItemType": "PHYSICAL", * "options": [ * { * "option": "Size", * "selection": "Medium" * } * ], * "customTextFields": [ * { * "title": "Notes for delivery", * "value": "Please leave at front door" * } * ], * "weight": 1.42, * "sku": "36523641234523", * "discount": 0, * "tax": 5, * "taxIncludedInPrice": true, * "priceData": { * "price": "5", * "totalPrice": 5, * "taxIncludedInPrice": true * }, * "mediaItem": { * "altText": "This is a description of the image", * "id": "fac9dc352bf7d54ed0458d64ce41a3ec.jpg", * "src": "wix:image://v1/fac9dc352bf7d54ed0458d64ce41a3ec.jpg/file.jpg#originWidth=1348&originHeight=899", * "type": "IMAGE" * } * } * ], * "totals": { * "discount": 0, * "quantity": 1, * "shipping": 0, * "subtotal": 5, * "tax": 0, * "total": 5, * "weight": 1.42 * }, * "weightUnit": "KG", * "customField": { * "value": "Please call when outside", * "title": "Notes for delivery", * "translatedTitle": "Notas de entrega" * }, * "discount": { * "appliedCoupon": { * "code": "47d259d6-7d1e-4ea5-a75c79ca9bb1", * "couponId": "558b511f-6eb7-82d3-53fca7374dfa", * "name": "Summer sale" * } * } * // The following field is only present when * // the order is a subscription * "subscriptionInfo": { * "id": "6b320feb-ddde-45be-950b-8ed277033579", * "cycleNumber": 1, * "subscriptionSettings": { * "frequency": "MONTH", * "autoRenewal": false, * "billingCycles": 3 * }, * "subscriptionOptionInfo": { * "id": "17c145c2-5d23-42c3-ac0a-e579e99c67fd", * "title": "Coffee of the month", * "description": "Monthly Coffee Sub" * } * } * } * */
Did this help?

onOrderRefunded( )


Deprecated. This event will continue to work until September 4, 2024, but a newer version is available at wix-ecom-backend.Events.onOrderTransactionsUpdated().

We recommend you migrate to the new Wix eCommerce APIs as soon as possible.

An event that fires when an order is refunded.

The onOrderRefunded() event handler runs when an order is refunded. For example, when an order is refunded in your site's Dashboard.

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

Method Declaration
Copy
function onOrderRefunded(event: OrderRefundedEvent): void;
Method Parameters
eventOrderRefundedEventRequired

Order refunded event.

An event when an order is refunded
JavaScript
// Place this code in the events.js file // of your site's Backend section. export function wixStores_onOrderRefunded(event) { const refundedOrderId = event.order._id; const refundId = event.refundId; } /* Full event object: * * { * "refundId": "0bf46037-de62-7848-af43-3a7f3c28b041", * "order": { * "_id": "d5d43d01-d9a4-4cc2-b257-61184b881447", * "_updatedDate": "2020-05-27T12:20:37.994Z", * "buyerLanguage": "en", * "cartId": "74621781-b3hf-7845-8c9e-09879063da9", * "channelInfo": { * "type": "WEB" * }, * "enteredBy": { * "id": "f6c2c0f9-4e9f-a58d-a02d-9af2497294d9", * "identityType": "MEMBER" * }, * "refunds": [ * { * "id": "0bf46037-de62-7848-af43-3a7f3c28b041", * "dateCreated": "2020-12-14T13:02:04.557Z", * "amount": "50", * "externalRefund": true, * "reason": "returned" * } * ], * "billingInfo": { * "address": { * "formatted": "My company name\n235 W 23rd St\nNew York, New York 10011\nUnited States\n+15555555555", * "city": "New York", * "country": "USA", * "addressLine": "235 W 23rd St", * "postalCode": "10011", * "subdivision": "NY" * }, * "firstName": "John", * "lastName": "Doe", * "email": "john.doe@somedomain.com", * "phone": "+15555555555", * "company": "My company name", * "externalTransactionId": "7c03ca74-eaf5-4541-8678-9b857634fdcb", * "paidDate": "2020-05-27T12:20:37.994Z", * "paymentMethod": "VISA", * "paymentGatewayTransactionId": "29A06193U6234935D", * "paymentProviderTransactionId": "7c03ca74-eaf5-4541-8678-9b857634fdcb" * }, * "buyerInfo": { * "id": "f6c2c0f9-4e9f-a58d-a02d-9af2497294d9", * "identityType": "MEMBER", * "firstName": "John", * "lastName": "Doe", * "phone": "+15555555555", * "email": "john.doe@somedomain.com" * }, * "_dateCreated": "2020-05-27T12:20:37.966Z", * "currency": "USD", * "fulfillmentStatus": "CANCELED", * "archived": false, * "activities": [ * { * "type": "ORDER_PLACED", * "timestamp": "2020-05-27T12:20:37.966Z" * }, * { * "type": "ORDER_PAID", * "timestamp": "2020-05-27T12:20:37.994Z" * } * ], * "number": 10019, * "paymentStatus": "FULLY_REFUNDED", * "shippingInfo": { * "deliveryOption": "Free Shipping", * "estimatedDeliveryTime": "4:30pm", * "shippingRegion": "Domestic", * "shipmentDetails": { * "address": { * "formatted": "235 W 23rd St\nNew York, New York 10011\nUnited States\n5555555555", * "city": "New York", * "country": "USA", * "addressLine": "235 W 23rd St", * "postalCode": "10011", * "subdivision": "NY" * }, * "firstName": "John", * "lastName": "Doe", * "email": "john.doe@somedomain.com", * "phone": "5555555555", * "company": "company name", * "tax": 0, * "discount": 0, * "priceData": { * "price": 0, * "taxIncludedInPrice": false * }, * }, * "pickupDetails": null * }, * "lineItems": [ * { * "index": 1, * "quantity": 1, * "price": 50, * "name": "my product's name", * "translatedName": "Nombre traducido", * "productId": "3fb6a3c8-988b-8755-04bd-5c59ae0b18ea", * "totalPrice": 5, * "lineItemType": "PHYSICAL", * "options": [ * { * "option": "Size", * "selection": "Medium" * } * ], * "customTextFields": [ * { * "title": "Notes for delivery", * "value": "Please leave at front door" * } * ], * "weight": 1.42, * "sku": "36523641234523", * "discount": 0, * "tax": 5, * "taxIncludedInPrice": true, * "priceData": { * "price": "50", * "totalPrice": 50, * "taxIncludedInPrice": true * }, * "mediaItem": { * "altText": "This is a description of the image", * "id": "fac9dc352bf7d54ed0458d64ce41a3ec.jpg", * "src": "wix:image://v1/fac9dc352bf7d54ed0458d64ce41a3ec.jpg/file.jpg#originWidth=1348&originHeight=899", * "type": "IMAGE" * } * } * ], * "totals": { * "discount": 0, * "quantity": 1, * "shipping": 0, * "subtotal": 50, * "tax": 0, * "total": 50, * "weight": 1.42 * }, * "weightUnit": "KG", * "customField": { * "value": "Please call when outside", * "title": "Notes for delivery", * "translatedTitle": "Notas de entrega" * }, * "discount": { * "appliedCoupon": { * "code": "47d259d6-7d1e-4ea5-a75c79ca9bb1", * "couponId": "558b511f-6eb7-82d3-53fca7374dfa", * "name": "Summer sale - Free Shipping" * } * } * } * } * */
Did this help?

onProductCreated( )


An event that fires when a product is created.

The onProductCreated() event handler runs when a new product is added to a store.

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

Method Declaration
Copy
function onProductCreated(event: ProductCreatedEvent): void;
Method Parameters
eventProductCreatedEventRequired

Information about the product that was created.

An event when a product is created
JavaScript
// Place this code in the events.js file // of your site's Backend section. export function wixStores_onProductCreated(event) { let productId = event._id; } /* Full event object: * * { * "_id": "5096485f-0239-3881-3f6a-63955708a4ec", * "name": "New Product", * "sku": "abc123", * "formattedDiscountedPrice": "$100.00", * "visible": true, * "mainMedia": "wix:image://v1/6...6.jpg/file.jpg#originWidth=2700&originHeight=2186", * "price": 100, * "formattedPrice": "$100.00", * "discountedPrice": 100, * "pricePerUnit": 0.1, * "formattedPricePerUnit": "$0.10", * "mediaItems": [ * { * "title": "Main Image", * "description": "Main Image", * "type": "IMAGE", * "src": "wix:image://v1/6...6.jpg/file.jpg#originWidth=2700&originHeight=2186" * } * ], * "currency": "USD", * "productPageUrl": "/product-page/new-product", * "ribbon": "New Arrival" * } * */
Did this help?

onProductDeleted( )


An event that fires when a product is deleted.

The onProductDeleted() event handler runs when a product is deleted from a store.

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

Method Declaration
Copy
function onProductDeleted(event: ProductDeletedEvent): void;
Method Parameters
eventProductDeletedEventRequired

Information about the product that was deleted.

An event when a product is deleted
JavaScript
// Place this code in the events.js file // of your site's Backend section. export function wixStores_onProductDeleted(event) { let productId = event.productId; } /* Full event object: * * { * "productId": "5096485f-0239-3881-3f6a-63955708a4ec" * } * */
Did this help?