Search.../

getPlanStats( )

Gets statistics about the pricing plans.

Description

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

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

Only users with "Manage Pricing Plans" permissions can get plan statistics.

Syntax

function getPlanStats(): Promise<PlansStats>

getPlanStats Parameters

This function does not take any parameters.

Returns

Fulfilled - Overall statistics about the pricing plans.

Return Type:

Promise<PlansStats>
NAME
TYPE
DESCRIPTION
total
number

Total number of plans created, including active plans (both public and hidden) and archived plans.

Was this helpful?

Get statistics for the pricing plans

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import wixPricingPlansBackend from 'wix-pricing-plans-backend';
3
4export const myGetPlanStatsFunction = webMethod(Permissions.Anyone, () => {
5 return wixPricingPlansBackend.getPlanStats()
6 .then((statistics) => {
7 console.log(statistics);
8 })
9 .catch((error) => {
10 console.error(error);
11 });
12});
13
14/* Statistics object relevant to the site's pricing plans:
15 *
16 * {
17 * // Count of all plans (public, hidden and archived)
18 * "total": 8
19 * }
20 *
21 */