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

Copy Code
1import { plans } from 'wix-pricing-plans.v2';
2import { elevate } from 'wix-auth';
3
4export async function myClearPrimaryFunction() {
5 try {
6 const elevatedClearPrimary = elevate(plans.clearPrimary);
7 const clearedPrimary = await elevatedClearPrimary();
8
9 return;
10 } catch (error) {
11 console.error(error);
12 // Handle the error
13 }
14}
15
16/* Promise resolves to void */