queryPublicPlans( )


Creates a query to retrieve a list of public pricing plans.

The queryPublicPlans() function builds a query to retrieve a list of up to 1,000 public plans and returns a PublicPlansQueryBuilder object.

The returned object contains the query definition which is typically used to run the query using the find() function.

You can refine the query by chaining PublicPlansQueryBuilder functions onto the query. PublicPlansQueryBuilder functions enable you to sort, filter, and control the results that queryPublicPlans() returns.

queryPublicPlans() runs with the following PublicPlansQueryBuilder defaults that you can override:

The functions that are chained to queryPublicPlans() are applied in the order they are called. For example, if you sort on the _createdDate property in ascending order and then on the _id property in ascending order, the results are sorted first by the created date of the items and then, if there are multiple results with the same date, the items are sorted by _id in ascending order, per created date value.

The following PublicPlansQueryBuilder functions are supported for the queryPublicPlans() function. For a full description of the Plans object, see the object returned for the items property in PublicPlansQueryResult.

PROPERTYSUPPORTED FILTERS & SORTING
_ideq(),ne(),exists(),in(),hasSome(),startsWith(),ascending(),descending()
primaryeq(),ne(),exists(),in(),hasSome(),ascending(),descending()
_createdDateeq(),ne(),exists(),in(),hasSome(),lt(),le(),gt(),ge(),ascending(),descending()
_updatedDateeq(),ne(),exists(),in(),hasSome(),lt(),le(),gt(),ge(),ascending(),descending()
slugeq(),ne(),exists(),in(),hasSome(),startsWith(),ascending(),descending()
Permissions
Manage Bookings Services and Settings
Manage Orders
Read Orders
Read Pricing Plans
Manage Pricing Plans
Manage Portfolio
Manage Restaurants - all permissions
Learn more about app permissions.
Method Declaration
Copy
function queryPublicPlans(): PlansQueryBuilder;
Request
This method does not take any parameters
Returns
Return Type:PlansQueryBuilder
JavaScript
import { plans } from "wix-pricing-plans.v2"; export async function myQueryPublicPlansFunction() { try { const results = await plans.queryPublicPlans().find(); const items = results.items; const firstItem = items[0]; const length = results.length; const currentPage = results.currentPage; return items; } catch (error) { console.error(error); // Handle the error } } /* Returned items: * [ * { * "_createdDate": "2024-01-07T08:18:16.411Z", * "_id": "7a3375ce-18a9-42cb-8e39-47918ade45ec", * "_updatedDate": "2024-01-07T08:18:16.411Z", * "allowFutureStartDate": false, * "archived": false, * "buyerCanCancel": true, * "description": "Affordable with great functionality. Expires after 1 year", * "hasOrders": false, * "maxPurchasesPerBuyer": 0, * "name": "Basic Plan - monthly subscription", * "perks": { * "values": [ * "Access to select video channels", * "Access to rich site content", * "Access to designated file store" * ] * }, * "primary": false, * "pricing": { * "cycleCount": 12, * "cycleDuration": { * "count": 1, * "unit": "MONTH" * }, * "price": { * "currency": "EUR", * "value": "5" * }, * "subscription": { * "cycleCount": 12, * "cycleDuration": { * "count": 1, * "unit": "MONTH" * } * } * }, * "slug": "basic-plan-monthly-subscription", * "termsAndConditions": "" * }, * { * "_createdDate": "2024-01-07T07:10:30.074Z", * "_id": "cb4a8c57-273a-4567-94e3-cc43d5d339f2", * "_updatedDate": "2024-01-07T07:10:30.074Z", * "allowFutureStartDate": false, * "archived": false, * "buyerCanCancel": true, * "description": "3 mo free trial with discount for 1 year", * "hasOrders": false, * "maxPurchasesPerBuyer": 0, * "name": "Beginner's Plan", * "perks": { * "values": [] * }, * "primary": false, * "pricing": { * "cycleCount": 2, * "cycleDuration": { * "count": 1, * "unit": "YEAR" * }, * "freeTrialDays": 90, * "price": { * "currency": "EUR", * "value": "50" * }, * "subscription": { * "cycleCount": 2, * "cycleDuration": { * "count": 1, * "unit": "YEAR" * } * } * }, * "slug": "beginners-plan", * "termsAndConditions": "" * }, * { * "_createdDate": "2024-01-07T07:28:42.863Z", * "_id": "838f2c9d-c8d0-4799-a10a-e2f23849db10", * "_updatedDate": "2024-01-07T08:36:07.520Z", * "allowFutureStartDate": false, * "archived": false, * "buyerCanCancel": true, * "description": "Complete with all features. One month free trial.", * "hasOrders": false, * "maxPurchasesPerBuyer": 0, * "name": "Premium Plan - annual - 30 day trial", * "perks": { * "values": [ * "Unlimited video library streaming access", * "File sharing enabled for all channels" * ] * }, * "primary": false, * "pricing": { * "cycleCount": 2, * "cycleDuration": { * "count": 1, * "unit": "YEAR" * }, * "freeTrialDays": 30, * "price": { * "currency": "EUR", * "value": "500" * }, * "subscription": { * "cycleCount": 2, * "cycleDuration": { * "count": 1, * "unit": "YEAR" * } * } * }, * "slug": "premium-plan-annual-30-day-trial-1", * "termsAndConditions": "Unlimited usage of services, subject to Fair Usage and Code of Conduct policies." * }, * { * "_createdDate": "2024-01-07T07:33:59.973Z", * "_id": "b20feb39-a452-453e-96ee-01036adcd04e", * "_updatedDate": "2024-01-09T09:08:05.665Z", * "allowFutureStartDate": false, * "archived": false, * "buyerCanCancel": true, * "description": "Full feature enablement - lifetime plan", * "hasOrders": false, * "maxPurchasesPerBuyer": 0, * "name": "Premium Plan - Lifetime Membership", * "perks": { * "values": [ * "Cloud drive and file upload services", * "Unlimited video content access" * ] * }, * "primary": false, * "pricing": { * "currency": "EUR", * "value": "1000", * "singlePaymentUnlimited": true * }, * "slug": "premium-plan-lifetime-membership", * "termsAndConditions": "This plan allows unlimited app and site features usage for all time, subject to our fair usage agreement and basic human decency agreement." * }, * { * "_createdDate": "2024-01-08T14:33:12.209Z", * "_id": "d2fa5805-0d1a-4cfb-9b43-e683cf5fa990", * "_updatedDate": "2024-01-08T14:33:12.209Z", * "allowFutureStartDate": false, * "archived": false, * "buyerCanCancel": true, * "description": "The value plan", * "hasOrders": false, * "maxPurchasesPerBuyer": 1, * "name": "Silver Membership - Monthly", * "perks": { * "values": [ * "Full site access", * "Full video access", * "Consultation booking" * ] * }, * "primary": false, * "pricing": { * "currency": "EUR", * "value": "100", * "freeTrialDays": 14, * "subscription": { * "cycleCount": 0, * "cycleDuration": { * "count": 1, * "unit": "MONTH" * } * } * }, * "slug": "silver-membership-monthly", * "termsAndConditions": "" * } * ] */
Errors

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

Did this help?