getPlanStats( )


Retrieves statistics about the pricing plans.

The getPlanStats() function returns a Promise that resolves to statistics about the plan on the site.

Currently this function provides only the total number of pricing plans, including archived plans.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Pricing Plans
Read Pricing Plans
Learn more about app permissions.
Method Declaration
Copy
function getPlanStats(): Promise<GetPlanStatsResponse>;
Request
This method does not take any parameters
Returns
Return Type:Promise<GetPlanStatsResponse>
JavaScript
import { plans } from "wix-pricing-plans.v2"; export async function myGetPlanStatsFunction() { try { const planStats = plans.getPlanStats(); return planStats; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * { * "totalPlans": 8 * } */
Errors

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

Did this help?