Introduction

When you execute a query with the find() function, it returns a Promise that resolves to a PublicPlansQueryResult object. This object contains the items that match the query, information about the query itself, and functions for paging through the query results.

Did this help?

currentPage


currentPagenumberRead-only

Returns the index of the current results page number.

The currentPage is a zero-based index of the current page of results.

The page size is defined by the limit() function, can be retrieved using the pageSize property, and navigating through pages is done with the prev() and next() functions.

The currentPage property returns undefined if the query returned no results.

JavaScript
const resultPage = results.currentPage; // 0
Did this help?

items


itemsArray<Item>Read-only

Returns the items that match the query.

The current page of items retrieved by the query.

The page size is defined by the limit() function, can be retrieved using the pageSize property, and navigating through pages is done with the prev() and next() functions.

When no items match the query, the items array is empty.

Perform a query and get the public pricing plan items from the result
JavaScript
import wixPricingPlansBackend from "wix-pricing-plans-backend"; // ... wixPricingPlansBackend .queryPublicPlans() .find() .then((results) => { if (results.items.length > 0) { const items = results.items; // see below } else { // handle case where no matching items found } }) .catch((error) => { const queryError = error; }); /* items: * [ * { * "plan": { * "_id": "5269ddde-a3a6-7c32-abc1-fe8af8331097", * "name": "Basic", * "description": "This plan provides the basics.", * "pricing": { * "singlePaymentUnlimited": true, * "price": { * "value": "50", * "currency": "USD" * } * }, * "primary": false, * "_createdDate": "2021-01-01T15:33:34.860Z", * "_updatedDate": "2021-01-14T10:30:30.870Z", * "slug": "basic", * "allowFutureStartDate": false, * "buyerCanCancel": true, * "termsAndConditions": "", * "perks": [ * "Essentials only", * "For beginners" * ] * } * }, * { * "plan": { * "_id": "31c26520-a3a6-7c32-abc1-d4b11e509a92", * "name": "Intermediate", * "description": "This plan provides intermediate capabilities", * "pricing": { * "subscription": { * "cycleDuration": { * "count": 1, * "unit": "MONTH" * }, * "cycleCount": 2 * }, * "price": { * "value": "25", * "currency": "USD" * }, * "freeTrialDays": 3 * }, * "primary": false, * "_createdDate": "2020-02-14T15:33:34.977Z", * "_updatedDate": "2021-01-14T10:30:30.970Z", * "slug": "intermediate", * "allowFutureStartDate": false, * "buyerCanCancel": true, * "termsAndConditions": "", * "perks": [ * "Cool templates you can reuse", * "Includes the Basic plan" * ] * } * }, * { * "plan": { * "_id": "6e01c2ae-b3b6-7a33-abc1-b7daf0fd125c", * "name": "Advanced", * "description": "This plan provides advanced capabilities", * "pricing": { * "subscription": { * "cycleDuration": { * "count": 1, * "unit": "YEAR" * }, * "cycleCount": 0 * }, * "price": { * "value": "100", * "currency": "USD" * } * }, * "primary": false, * "_createdDate": "2020-12-14T15:33:35.677Z", * "_updatedDate": "2021-01-14T11:33:11.677Z", * "slug": "advanced", * "allowFutureStartDate": false, * "buyerCanCancel": true, * "perks": [ * "Extra utilities, plug-ins", * "Includes the Intermediate Plan" * ] * } * }, * { * "plan": { * "_id": "a7fff6ae-b3b6-7a33-abc1-2b9f8b39e6c5", * "name": "Advanced VIP", * "description": "This plan provides a lot of extras that are really cool in addition to the regular Advanced plan", * "pricing": { * "singlePaymentUnlimited": true, * "price": { * "value": "125", * "currency": "USD" * } * }, * "primary": false, * "_createdDate": "2021-01-14T15:33:35.782Z", * "_updatedDate": "2021-01-14T15:33:35.782Z", * "slug": "advanced-vip", * "allowFutureStartDate": false, * "buyerCanCancel": true, * "termsAndConditions": "", * "perks": [ * "Free beer and champagne sent to your home when you purchase the plan", * "Discount on our merchandise", * "Includes the Advanced plan" * ] * } * } * ] */
Did this help?

length


lengthnumberRead-only

Returns the number of items in the current results page.

The page size is defined by the limit() function, can be retrieved using the pageSize property, and navigating through pages is done with the prev() and next() functions.

JavaScript
const resultLength = results.length; // 20
Did this help?

pageSize


pageSizenumberRead-only

Returns the query page size.

The page size is defined by the limit() function, can be retrieved using the pageSize property, and navigating through pages is done with the prev() and next() functions.

JavaScript
const resultPageSize = results.pageSize; // 50
Did this help?