> 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: setPlanVisibility(_id: string, visible: boolean)

# Method package: wixPricingPlansV2

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

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

# Method Description:

Sets visibility for pricing plans. Visible plans are considered public plans.
By default, pricing plans are public, meaning they are visible. Plans can be hidden so that site members and visitors can't choose them.
As opposed to archiving, setting visibility can be reversed. This means that a public plan can be hidden, and a hidden plan can be made public (visible). (An archived plan always remains archived and can't be made active again.)
Changing a plan’s visibility doesn't impact existing orders for the plan. All orders for hidden plans are still active and keep their perks.



# Method Code Examples:

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

## Hide a plan (dashboard page code)

```javascript
import { plans } from 'wix-pricing-plans.v2';

/* Sample _id value: 'cb4a8c57-273a-4567-94e3-cc43d5d339f2'
 * 
 * Sample visible value: false
 */

export async function mySetPlanVisibilityFunction(_id, visible) {
  try {
    const hiddenPlan = plans.setPlanVisibility(_id,visible);

    return hiddenPlan;
  } catch(error) {
    console.error(error);
    // Handle the error
  }
}
  
/* Promise resolves to:
 * {
 *   "plan": {
 *     "_createdDate": "2024-01-07T07:10:30.074Z",
 *     "_id": "cb4a8c57-273a-4567-94e3-cc43d5d339f2",
 *     "_updatedDate": "2024-01-14T09:29:12.581Z",
 *     "allowFutureStartDate": false,
 *     "archived": false,
 *     "buyerCanCancel": true,
 *     "description": "3 mo free trial with discount for 1 year",
 *     "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb",
 *     "hasOrders": false,
 *     "maxPurchasesPerBuyer": 0,
 *     "name": "Beginner's Plan",
 *     "perks": {
 *       "values": []
 *     },
 *     "primary": false,
 *     "pricing": {
 *       "cycleCount": 2,
 *       "cycleDuration": {
 *         "count": 1,
 *         "unit": "YEAR"
 *       },
 *       "freeTrialDays": 90,
 *       "price": {
 *         "currency": "EUR",
 *         "value": "50"
 *       },
 *       "subscription": {
 *         "cycleCount": 2,
 *         "cycleDuration": {
 *           "count": 1,
 *           "unit": "YEAR"
 *         }
 *       }
 *     },
 *     "public": false,
 *     "slug": "beginners-plan",
 *     "termsAndConditions": ""
 *   }
 * }
 */ 
```

## Hide 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: 'cb4a8c57-273a-4567-94e3-cc43d5d339f2'
 * 
 * Sample visible value: false
 */

export const mySetPlanVisibilityFunction = webMethod(Permissions.Anyone, async (_id, visible) => {
  try {
    const elevatedSetPlanVisibility = elevate(plans.setPlanVisibility);
    const hiddenPlan = elevatedSetPlanVisibility(_id,visible);

    return hiddenPlan;
  } catch(error) {
    console.error(error);
    // Handle the error
  }
});
  
/* Promise resolves to:
 * {
 *   "plan": {
 *     "_createdDate": "2024-01-07T07:10:30.074Z",
 *     "_id": "cb4a8c57-273a-4567-94e3-cc43d5d339f2",
 *     "_updatedDate": "2024-01-14T09:29:12.581Z",
 *     "allowFutureStartDate": false,
 *     "archived": false,
 *     "buyerCanCancel": true,
 *     "description": "3 mo free trial with discount for 1 year",
 *     "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb",
 *     "hasOrders": false,
 *     "maxPurchasesPerBuyer": 0,
 *     "name": "Beginner's Plan",
 *     "perks": {
 *       "values": []
 *     },
 *     "primary": false,
 *     "pricing": {
 *       "cycleCount": 2,
 *       "cycleDuration": {
 *         "count": 1,
 *         "unit": "YEAR"
 *       },
 *       "freeTrialDays": 90,
 *       "price": {
 *         "currency": "EUR",
 *         "value": "50"
 *       },
 *       "subscription": {
 *         "cycleCount": 2,
 *         "cycleDuration": {
 *           "count": 1,
 *           "unit": "YEAR"
 *         }
 *       }
 *     },
 *     "public": false,
 *     "slug": "beginners-plan",
 *     "termsAndConditions": ""
 *   }
 * }
 */ 

```

---