User Collections
The User Collections feature enables storefront users to create, manage, and share collections of products. Users can set collections as either public or private, with the default setting being private. Public collections are accessible to all users, including anonymous ones, via a specific URL, whereas private collections are only accessible to the collection owner.
Features:
Create Collections: Users can create new collections and define their visibility status.
Manage Collections: Users can update, rename, or change the visibility status of their collections.
Product Management: Users can add or remove products from their collections.
POST
Create a Collection
POST
Create a CollectionThis endpoint allows users to create a new user collection.
Path: https://{commerce_url}/wishlists/user-collections/
Body Parameters
name
string
mandatory
The name of the collection.
status
string
optional
Visibility status of the collection (public
or private
). Defaults to private
.
Example Request
Example Response (201 Created)
GET
List Collections
GET
List CollectionsRetrieve a list of collections created by the user. Collections can be filtered by name or product ID.
Path: https://{commerce_url}/wishlists/user-collections/
Request Parameters
search
string
Filter collections by name.
product_id
integer
Filter collections that contain a specific product ID.
Example Response (200 OK)
PATCH
Update a Collection
PATCH
Update a CollectionThis endpoint allows users to rename or change the visibility status of a collection.
Path: https://{commerce_url}/wishlists/user-collections/
Body Parameters
name
string
No
The new name for the collection.
status
string
No
New visibility status (public or private).
Example Request
Example Response (200 OK)
GET
Retrieve a Collection
GET
Retrieve a CollectionRetrieve the details of a specific user collection by its primary key (pk).
Path: https://{commerce_url}/wishlists/user-collections/<pk>/
Example Response (200 OK)
DELETE
Delete a Collection
DELETE
Delete a CollectionThis endpoint allows users to delete a specific user collection by its primary key (pk).
Path: https://{commerce_url}/wishlists/user-collections/<pk>/
Example Response (204 No Content)
204 No Content successful response status code indicates that a user collection has been deleted.
POST
Add a Product to a Collection
POST
Add a Product to a CollectionAllows users to add a product to a specific collection, along with an optional note.
Path: https://{commerce_url}/wishlists/user-collection-items/
Body Parameters
product_id
integer
Yes
The ID of the product to add.
usercollection_id
integer
Yes
The ID of the collection.
note
string
No
An optional note associated with the product in the collection.
Example Request
Example Response (201 Created)
DELETE
Remove a Product from a Collection
DELETE
Remove a Product from a CollectionThis endpoint allows users to remove a product from a specific collection using the collection item’s primary key (pk).
Path: https://{commerce_url}/wishlists/user-collection-items/<pk>/
Example Response (204 No Content)
204 No Content successful response status code indicates that a product has been removed from a collection.
GET
Retrieve a Public User Collection
GET
Retrieve a Public User CollectionAllows anyone to retrieve the details of a public user collection using the collection's slug.
Path: https://{commerce_url}/wishlists/user-collection/<slug>/
Example Response (200 OK)
Was this helpful?