archivePlan( )
Archives a single pricing plan.
Description
The archivePlan()
function returns a promise that resolves to the newly-archived plan.
When a plan is archived, the plan:
- Is no longer available for display or selection by visitors. This is because
the plan's
visibility
property is automatically set tofalse
. - Cannot be purchased.
- Cannot be "un-archived" (meaning, the plan cannot be made active again).
Plan archiving does not impact existing purchases made for the plan. All purchases for the plan are still active and keep their payment options and terms.
Site owners can see archived plans in the Dashboard under Pricing Plans -> Archived Plans.
Only users with "Manage Pricing Plans" permissions can archive plans.
Note: An attempt to archive an already-archived plan throws an error.
Syntax
function archivePlan(id: string): Promise<Plan>
archivePlan Parameters
NAME
TYPE
DESCRIPTION
ID of the active plan to archive.
Returns
Fulfilled - The archived plan. Rejected - Error message.
Return Type:
NAME
TYPE
DESCRIPTION
Plan ID.
Plan name.
Plan description.
List of text strings that promote the pricing plan (for example, "Plenty of parking" or "Free gift on your birthday").
Plan price, payment schedule, and expiration.
Whether the plan is public (visible to site visitors).
Whether the plan is archived. Archived plans are not visible and can't be purchased anymore, but existing purchases remain in effect.
Whether the plan is marked as primary. If true
, the plan is highlighted on the site with a custom ribbon. Defaults to false
.
Whether the plan has any orders (including pending and unpaid orders).
Date plan was created.
Date plan was last updated.
URL-friendly version of the plan name. Unique across all plans in the same site.
Whether the buyer can start the plan at a later date.
Whether the buyer is allowed to cancel their plan. If false
, calling the cancelOrder()
function returns an error.
Whether the same buyer can purchase the plan multiple times. 1
means the buyer can only purchase the plan once. An empty value or 0
means no limitation.
Any terms and conditions that apply to the plan. This information is displayed during checkout.
Was this helpful?
Archive a plan
1import wixPricingPlansBackend from 'wix-pricing-plans-backend';23export function myArchivePlanFunction() {4 const planId = '411a5551-b0f6-4826-8a41-ebae2879f857';5 return wixPricingPlansBackend.archivePlan(planId)6 .then((plan) => {7 const archivedPlanId = plan._id;8 console.log(archivedPlanId);9 })10 .catch((error) => {11 console.error(error);12 });13 }1415/* Returns a promise that resolves to a plan object for the archived plan:16 *17 * {18 * "plan": {19 * "_id": "411a5551-b0f6-4826-8a41-ebae2879f857",20 * "name": "Gold",21 * "description": "Gold membership to the MyGame World of Online Gaming",22 * "perks": [23 * "Multiplayer",24 * "Multiple devices",25 * "No ads",26 * "Unlimited access"27 * ],28 * "pricing": {29 * "subscription": {30 * "cycleDuration": {31 * "count": 1,32 * "unit": "WEEK"33 * },34 * "cycleCount": 135 * },36 * "price": {37 * "value": "15",38 * "currency": "USD"39 * }40 * },41 * "public": false,42 * "archived": true,43 * "primary": false,44 * "hasOrders": false,45 * "_createdDate": "2020-12-21T15:13:09.492Z",46 * "_updatedDate": "2020-12-30T08:02:14.867Z",47 * "slug": "gold",48 * "allowFutureStartDate": false,49 * "buyerCanCancel": true,50 * "termsAndConditions": "No sharing access with others!"51 * }52 */