Creates a query to retrieve a list of serviceOptionsAndVariants
objects.
The queryServiceOptionsAndVariants()
function builds a query to retrieve a list of serviceOptionsAndVariants
objects and returns a ServiceOptionsAndVariantsQueryBuilder
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 ServiceOptionsAndVariantsQueryBuilder
functions onto the query. ServiceOptionsAndVariantsQueryBuilder
functions enable you to sort, filter, and control the results that queryServiceOptionsAndVariants()
returns.
queryServiceOptionsAndVariants()
runs with the following ServiceOptionsAndVariantsQueryBuilder
default that you can override:
limit
is 50
.id
in ascending order.The 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"
.
The 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() |
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.