changeStartDate( )


Change the start date of a draft order.

Deprecated. This function will continue to work, but will soon be deprecated.

The changeStartDate() function returns a promise that resolves to a draft of the Order object with an updated startDate.

This function cannot be called on paid orders. When an order is paid for, it is no longer considered a draft and its start date cannot be changed.

The onOrderStartDateChanged() and onOrderUpdated() event handlers run when the start date of an order is changed.

The member must be logged in to change the start date of their order. Members cannot change the start date of other members' orders.

Method Declaration
Copy
function changeStartDate(orderId: string, startDate: Date): Promise<Order>;
Method Parameters
orderIdstringRequired

Draft order ID.


startDateDateRequired

New start date and time to update the startDate at which the order will become active.

Returns
Return Type:Promise<Order>
Change the start date of a draft order
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { checkout } from "wix-pricing-plans-backend"; export const myChangeStartDateFunction = webMethod(Permissions.Anyone, () => { const orderId = "4d771642-2e36-4078-a294-105649e1ed05"; const startDate = new Date("September 19, 2021 10:00:00"); return checkout .changeStartDate(orderId, startDate) .then((draft) => { const orderPlan = draft.planName; const orderStatus = draft.status; const orderStart = draft.startDate; }) .catch((error) => { console.error(error); }); }); /* Promise resolves to: * * { * "_id": "4d771642-2e36-4078-a294-105649e1ed05", * "planId": "5cfdba28-283f-4859-98f8-ebb7af542d41", * "subscriptionId": "0a0304bc-7aae-474c-a2b5-81e3e7925c24", * "wixPayOrderId": "cd5e42ba-5de4-4ba1-b2e3-410cd46dde60", * "buyer": { * "memberId": "4c47c608-cfa8-4037-93ac-738f09560ed3", * "contactId": "4c47c608-cfa8-4037-93ac-738f09560ed3" * }, * "priceDetails": { * "subtotal": "25", * "discount": "0", * "total": "25", * "planPrice": "25", * "currency": "USD", * "singlePaymentForDuration": { * "count": 6, * "unit": "MONTH" * } * }, * "pricing": { * "singlePaymentForDuration": { * "count": 6, * "unit": "MONTH" * }, * "prices": [ * { * "duration": { * "cycleFrom": 1 * }, * "price": { * "subtotal": "25", * "discount": "0", * "total": "25", * "currency": "USD" * } * } * ] * }, * "type": "ONLINE", * "orderMethod": "UNKNOWN", * "status": "DRAFT", * "lastPaymentStatus": "UNPAID", * "startDate": "2021-09-19T10:00:00.000Z", * "endDate": "2022-03-19T10:00:00.000Z", * "pausePeriods": [], * "earliestEndDate": "2022-03-19T10:00:00.000Z", * "currentCycle": { * "index": 1, * "startedDate": "2021-09-19T10:00:00.000Z", * "endedDate": "2022-03-19T10:00:00.000Z" * }, * "planName": "Vegetarian Cooking", * "planDescription": "Weekly delivery of vegetarian recipes and vegan recipes", * "planPrice": "25", * "_createdDate": "2021-08-26T16:32:20.808Z", * "_updatedDate": "2021-08-27T14:53:10.084Z" * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?