Setup

@wix/stores

To use the Collections API, install the @wix/stores package using npm or Yarn:

Copy

or

Copy

Then import { collections } from @wix/stores:

Copy
Did this help?

getCollection( )


Retrieves a collection with the provided ID.

Method Declaration
Copy
Method Parameters
_idstringRequired

Requested collection ID.

Returns
Return Type:Promise<Collection>
JavaScript
Errors

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

Did this help?

getCollectionBySlug( )


Retrieves a collection with the provided slug.

Method Declaration
Copy
Method Parameters
slugstringRequired

Slug of the collection to retrieve.

Returns
Return Type:Promise<GetCollectionBySlugResponse>
JavaScript
Errors

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

Did this help?

queryCollections( )


Retrieves a list of up to 100 collections, given the provided paging, sorting and filtering. See Stores Pagination for more information.

PROPERTYSUPPORTED FILTERS & SORTING
_ideq(),ne(),exists(),in(),hasSome(),startsWith(),ascending(),descending()
nameeq(),ne(),exists(),in(),hasSome(),startsWith(),ascending(),descending()
Method Declaration
Copy
function queryCollections(): CollectionsQueryBuilder;
Request
This method does not take any parameters
Returns
JavaScript
import { collections } from "@wix/stores"; async function queryCollections() { const { items } = await collections.queryCollections().find(); }
Errors

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

Did this help?