setPlanVisibility( )


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.

Authentication
  • When developing websites or building an app with Blocks, this method may require elevated permissions, depending on the identity of the user calling it and the calling user’s permissions.
  • When building apps without Blocks or for headless projects, you can only call this method directly when authenticated as a Wix app or Wix user identity. When authenticated as a different identity, you can call this method using elevation.
  • Elevation permits users to call methods they typically cannot access. Therefore, you should only use it intentionally and securely.
Permissions
Manage Pricing Plans
Learn more about app permissions.
Method Declaration
Copy
function setPlanVisibility(
  _id: string,
  visible: boolean,
): Promise<SetPlanVisibilityResponse>;
Method Parameters
_idstringRequired

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


visiblebooleanRequired

Whether a plan is visible to members and site visitors. Updates the public field.

Returns
Return Type:Promise<SetPlanVisibilityResponse>
JavaScript
import { plans } from "@wix/pricing-plans"; async function setPlanVisibility(id, visible) { const response = await plans.setPlanVisibility(id, visible); }
Errors

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

Did this help?