setPlanVisibility( )


Sets visibility for non-archived pricing plans. Public plans are plans that are set to visible.

The setPlanVisibility() function returns a Promise that resolves to a pricing plan when its visibility has successfully been set.

By default, pricing plans are public, meaning they are visible. Plans can be hidden so that site members and visitors cannot see or 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).

Note: An archived plan always remains archived and cannot be made active again. When archiving a plan, its visibility property is automatically set to false so that it is hidden.

Changing a plan’s visibility does not impact existing orders for the plan. All orders for hidden plans are still active and keep their terms and payment options.

Only users with "Manage Pricing Plans" permissions can change plan visibility.

Method Declaration
Copy
function setPlanVisibility(id: string, visible: boolean): Promise<Plan>;
Method Parameters
idstringRequired

The ID of the plan to either display or hide on the site page.


visiblebooleanRequired

Whether the plan is visible.

Returns
Return Type:Promise<Plan>
Hide a plan
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import wixPricingPlansBackend from "wix-pricing-plans-backend"; export const mySetPlanVisibilityFunction = webMethod(Permissions.Anyone, () => { const planId = "3743d382-a4d4-7e15-ada5-340ad4b5d760"; const visibilityToggle = false; return wixPricingPlansBackend .setPlanVisibility(planId, visibilityToggle) .then(() => { console.log("Plan hidden"); // Plan is visible in the Dashboard }) .catch((error) => { console.error(error); }); }); /* Full event object: * { * "metadata": { * "id": "3743d382-a4d4-7e15-ada5-340ad4b5d760", * "entityId": "c61bbc26-a4d4-7e15-ada5-f99803abce33", * "eventTime": "2020-02-03T10:13:15.194Z", * "triggeredByAnonymizeRequest": false * }, * "entity": { * "_id": "c61bbc26-a4d4-7e15-ada5-f99803abce33", * "name": "Full membership", * "description":"Full membership including weekends", * "perks": [ * "Free parking", * "Express line" * ], * "pricing": { * "singlePaymentUnlimited": true, * "price": { * "value": "40", * "currency": "USD" * } * }, * "public" : true, * "_createdDate": "2020-02-03T10:13:15.194Z", * "_updatedDate": "2020-02-03T10:13:15.194Z", * "slug":"full-membership", * "maxPurchasesPerBuyer": 1, * "allowFutureStartDate": false, * "buyerCanCancel": true, * "termsAndConditions": "Copyright laws apply." * } * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?