An event that triggers when the endDate
of an order is postponed or made earlier.
The onOrderEndDatePostponed()
event handler runs when an order is postponed or made earlier.
The received OrderEndDatePostponedEvent
object contains information about the order that was postponed.
Note: Backend events don't work when previewing your site.
function onOrderEndDatePostponed(event: OrderEndDatePostponedEvent): void;
Information about the order that is postponed 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_onOrderEndDatePostponed(event) {
const orderId = event.data.order._id;
const eventId = event.metadata.id;
const eventTime = event.metadata.eventTime;
}
/* Full event object:
* {
* "metadata": {
* "id":"e10b1220-8380-41c4-9f13-853ed4736f5a",
* "entityId":"1601de9d-c6ff-494e-a6b7-b84e99b178bb",
* "eventTime":"2022-07-26T16:01:13.138635Z",
* "triggeredByAnonymizeRequest":false
* },
* "data": {
* "order": {
* "_id":"1601de9d-c6ff-494e-a6b7-b84e99b178bb",
* "planId":"2900552c-012f-43c9-b724-90503d273a4d",
* "subscriptionId":"f0899480-1b5a-4b91-aa5f-28ad6a5058e9",
* "buyer": {
* "memberId":"c3d92519-3488-49b5-8ad5-c411ef52d833",
* "contactId":"c3d92519-3488-49b5-8ad5-c411ef52d833"
* },
* "priceDetails": {
* "subtotal":"0",
* "discount":"0",
* "total":"0",
* "planPrice":"0",
* "currency":"EUR",
* "singlePaymentForDuration": {
* "count":6,
* "unit":"MONTH"
* }},
* "pricing": {
* "singlePaymentForDuration": {
* "count":6,"unit":"MONTH"
* },
* "prices": [{
* "duration": {
* "cycleFrom":1,
* "numberOfCycles":1
* },
* "price": {
* "subtotal":"0",
* "discount":"0",
* "total":"0",
* "currency":"EUR"
* }
* }]},
* "type":"OFFLINE",
* "orderMethod":"UNKNOWN",
* "status":"ACTIVE",
* "lastPaymentStatus":"NOT_APPLICABLE",
* "startDate":"2022-07-02T16:23:00.000Z",
* "endDate":"2023-01-04T16:23:00.000Z",
* "pausePeriods":[],
* "earliestEndDate":"2023-01-02T16:23:00.000Z",
* "currentCycle": {
* "index":1,
* "startedDate":"2022-07-02T16:23:00.000Z",
* "endedDate":"2023-01-04T16:23:00.000Z"
* },
* "planName":"Free, 6 Months",
* "planDescription":"",
* "planPrice":"0",
* "_createdDate":"2022-07-13T20:37:06.543Z",
* "_updatedDate":"2022-07-26T16:01:13.029Z"
* }
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.