Search...
clearPrimary( )
Sets all pricing plans to no longer be primary.
Description
The clearPrimary()
function returns a Promise that is resolved when there are no pricing plans marked as primary
.
After clearing the primary plan, when viewing pricing plans on the site, no plan is highlighted with a customizable ribbon.
Admin Method
This function requires elevated permissions to run. This function is not universal and runs only on the backend.
Syntax
function clearPrimary(): Promise<void>
clearPrimary Parameters
This function does not take any parameters.
Returns
Return Type:
Promise<
void
>Was this helpful?
Clear the primary plan (dashboard page code)
Copy Code
1import { plans } from 'wix-pricing-plans.v2';23export async function myClearPrimaryFunction() {4 try {5 const clearedPrimary = await plans.clearPrimary();67 return;8 } catch (error) {9 console.error(error);10 // Handle the error11 }12}1314/* Promise resolves to void */
Clear the primary plan (export from backend code)
Copy Code
1import { Permissions, webMethod } from 'wix-web-module';2import { plans } from 'wix-pricing-plans.v2';3import { elevate } from 'wix-auth';45export const myClearPrimaryFunction = webMethod(Permissions.Anyone, async () => {6 try {7 const elevatedClearPrimary = elevate(plans.clearPrimary);8 const clearedPrimary = await elevatedClearPrimary();910 return;11 } catch (error) {12 console.error(error);13 // Handle the error14 }15});1617/* Promise resolves to void */18