Collection
Represents the Collection entity of your store. Collections are organized in a tree structure (hierarchical) and are used to navigate the catalog and group products.
Collection Definition
| Property | Type | Description |
|---|---|---|
| id | string (UUID) | Unique identifier of the collection. |
| name | string | Name of the collection. |
| slug | string | Part of the URL used to navigate to the collection (SEO-friendly). |
| parentId | string | null | ID of the parent collection (null if it is a root collection). |
| position | number | Display order relative to other collections at the same level. |
| visible | boolean | Indicates whether the collection should be shown on the front-end. |
| filterIds | string[] | Array of filter IDs pre-applied to this collection. |
| children | Collection[] | Recursive: Array of child collections contained within this collection. |
Recursive Structure
The Collection entity is designed to support unlimited depth. The children property contains an array of objects that follow the same Collection interface, allowing you to map the entire catalog tree (e.g., Men > Shoes > Sneakers).
Object Example
{
"id": "ee91d632-ca63-400e-b93d-4369c080da4e",
"name": "Apparel",
"slug": "apparel",
"parentId": null,
"position": 0,
"visible": true,
"filterIds": [
"7d88d702-0684-411f-89ba-5ab13c06fa51"
],
"children": [
{
"id": "ae087773-3708-4c61-b72e-426a7580cc90",
"name": "T-Shirts",
"slug": "t-shirts",
"parentId": "ee91d632-ca63-400e-b93d-4369c080da4e",
"position": 0,
"visible": true,
"filterIds": [],
"children": []
}
]
}
Navigation
You can use the utilities in wr.shop to change the catalog context, such as wr.shop.navigateToCollection(collectionId)