> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# Method name: archivePlan(_id: string)

# Method package: wixPricingPlansV2

# Method menu location: wixPricingPlansV2 --> plans --> archivePlan

# Method Link: https://dev.wix.com/docs/velo/apis/wix-pricing-plans-v2/plans/archive-plan.md

# Method Description:

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.



# Method Code Examples:

*** Note: do not assume any prop names or enum values other than the ones in the example.

## Archive a plan (dashboard page code)

```javascript
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."
 * } 
 */
```

## Archive a plan (export from backend code)

```javascript
import { Permissions, webMethod } from 'wix-web-module';
import { plans } from 'wix-pricing-plans.v2';
import { elevate } from 'wix-auth';

/* Sample _id value: '1421abaa-44c7-42ae-8a75-960fe7a8aa55' */

export const myArchivePlanFunction = webMethod(Permissions.Anyone, async (_id) => {
  try {
    const elevatedArchivePlan = elevate(plans.archivePlan);
    const archivedPlan = await elevatedArchivePlan(_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."
 * } 
 */
```

---