Creates a query to retrieve a list of serviceOptionsAndVariants
objects.\n\nThe queryServiceOptionsAndVariants()
function builds a query to retrieve a list of serviceOptionsAndVariants
objects and returns a ServiceOptionsAndVariantsQueryBuilder
object.\n\nThe returned object contains the query definition, which is typically used to run the query using the find() function.\n\nYou can refine the query by chaining ServiceOptionsAndVariantsQueryBuilder
functions onto the query. ServiceOptionsAndVariantsQueryBuilder
functions enable you to sort, filter, and control the results that queryServiceOptionsAndVariants()
returns.\n\nqueryServiceOptionsAndVariants()
runs with the following ServiceOptionsAndVariantsQueryBuilder
default that you can override:\n\n+ limit
is 50
.\n+ Sorted by id
in ascending order.\n\nThe functions that are chained to queryServiceOptionsAndVariants()
are applied in the order they are called. For example, if you apply ascending("options.values.type")
and then ascending("variants.values.price")
, the results are sorted first by the "type"
, and then, if there are multiple results with the same "type"
, the items are sorted by "price"
.\n\nThe following ServiceOptionsAndVariantsQueryBuilder
functions are supported for the queryServiceOptionsAndVariants()
function. For a full description of the serviceOptionsAndVariants
object, see the object returned for the items property in ServiceOptionsAndVariantsQueryResult
.
PROPERTY | SUPPORTED FILTERS & SORTING |
---|---|
_id | eq() ,in() ,ne() ,ascending() ,descending() |
serviceId | eq() ,in() ,ne() ,ascending() ,descending() |
options.values | exists() |
options.values.id | hasSome() |
options.values.type | hasSome() |
variants.values | exists() |
variants.values.choices.custom | hasSome() |
variants.values.choices.optionId | hasSome() |
variants.values.price.value | hasSome() |
variants.values.price.currency | hasSome() |
function queryServiceOptionsAndVariants(): ServiceOptionsAndVariantsListQueryBuilder;
import { serviceOptionsAndVariants } from "@wix/bookings";
async function queryServiceOptionsAndVariants() {
const { items } = await serviceOptionsAndVariants
.queryServiceOptionsAndVariants()
.find();
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.