An event that triggers when the start date of an order is changed.
The onOrderStartDateChanged()
event handler runs when an order's start date is changed.
The received OrderStartDateChangedEvent
object contains information about the order whose start date changed.
Note: Backend events don't work when previewing your site.
function onOrderStartDateChanged(event: OrderStartDateChangedEvent): void;
Information about the order that has a changed start date and metadata for the event.
// Place this code in the events.js file
// of your site's Backend section.
// Add the file if it doesn't exist.
export function wixPricingPlans_onOrderStartDateChanged(event) {
const orderId = event.data.order._id;
const eventId = event.metadata.id;
const eventTime = event.metadata.eventTime;
}
/* Full event object:
* {
* "metadata": {
* "id":"d1ee0aa4-0c77-4481-a857-be913269ad6b",
* "entityId":"13e8df07-b26d-43a1-8ce3-8206bce9e083",
* "eventTime":"2022-07-27T09:48:51.178785Z",
* "triggeredByAnonymizeRequest":false
* },
* "data": {
* "order": {
* "_id":"13e8df07-b26d-43a1-8ce3-8206bce9e083",
* "planId":"6d7537c5-beac-44a3-bea3-b947ddc56b31",
* "subscriptionId":"e7c79eb1-9bd9-4db4-be18-d02187b2aef8",
* "wixPayOrderId":"ccc8dcd0-582d-48b4-a692-f69882108b03",
* "buyer": {
* "memberId":"0c9bca47-1f00-4b92-af1c-7852452e949a",
* "contactId":"0c9bca47-1f00-4b92-af1c-7852452e949a"
* },
* "priceDetails": {
* "subtotal":"14.99",
* "discount":"0",
* "total":"14.99",
* "planPrice":"14.99",
* "currency":"EUR",
* "subscription": {
* "cycleDuration": {
* "count":1,
* "unit":"MONTH"
* },
* "cycleCount":0
* }},
* "pricing": {
* "subscription": {
* "cycleDuration": {
* "count":1,
* "unit":"MONTH"
* },
* "cycleCount":0
* },
* "prices":
* [{
* "duration": {
* "cycleFrom":1
* },
* "price": {
* "subtotal":"14.99",
* "discount":"0",
* "total":"14.99",
* "currency":"EUR"
* }
* }]},
* "type":"ONLINE",
* "orderMethod":"UNKNOWN",
* "status":"DRAFT",
* "autoRenewCanceled":false,
* "lastPaymentStatus":"UNPAID",
* "startDate":"2022-08-15T10:00:00.000Z",
* "pausePeriods":[],
* "planName":"2x Week",
* "planDescription":"",
* "planPrice":"14.99",
* "_createdDate":"2022-07-27T09:47:20.466Z",
* "_updatedDate":"2022-07-27T09:48:51.150Z"
* }
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.