Archives a single plan.
When a plan is archived, it's no longer visible as a public plan that can be chosen by site members or visitors.
This is because the plan's public
property is automatically set to false
.
Archived plans can't be purchased or reactivated.
Plan archiving doesn't impact existing orders made for the plan. All orders for the plan are still active and keep their perks, payment options, and terms.
Wix users can see archived plans in a site's dashboard under Pricing Plans -> Archived Plans.
Note: An attempt to archive an already-archived plan throws an error.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function archivePlan(_id: string): Promise<ArchivePlanResponse>;
ID of the active plan to archive.
import { plans } from "wix-pricing-plans.v2";
/* Sample _id value: '1421abaa-44c7-42ae-8a75-960fe7a8aa55' */
export async function myArchivePlanFunction(_id) {
try {
const archivedPlan = await plans.archivePlan(_id);
return archivedPlan;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* "_createdDate": "2023-12-31T11:23:01.664Z",
* "_id": "1421abaa-44c7-42ae-8a75-960fe7a8aa55",
* "_updatedDate": "2024-01-08T11:24:18.561Z",
* "allowFutureStartDate": false,
* "archived": true,
* "buyerCanCancel": true,
* "description": "Free Plan",
* "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb",
* "hasOrders": false,
* "maxPurchasesPerBuyer": 0,
* "name": "Basic",
* "perks": {
* "values": []
* },
* "pricing": {
* "price": {
* "currency": "EUR",
* "value": "0"
* },
* "singlePaymentForDuration": {
* "count": 3,
* "unit": "MONTH"
* }
* },
* "primary": false,
* "public": false,
* "slug": "basic",
* "termsAndConditions": "After 90 day free trial ends, your plan will end and you will need to purchase a paid plan."
* }
*/
There is 1 error with this status code.
There is 1 error with this status code.
This method may also return standard errors. Learn more about standard Wix errors.