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