Search.../

removeProductsFromCollection( )

Removes products by ID from a collection.

Description

The removeProductsFromCollection() function returns a Promise that resolves when the products with the given IDs are removed from a specified collection.

You can remove multiple products from a collection at one time by delimiting the list of products with commas.

If you do not specify any IDs, all products are removed from the collection.

Removing products from a collection does not delete the products from the store. See deleteProduct() to delete a product from the store.

Authorization

Request

This endpoint does not take any parameters

Response Object

Fulfilled - When the products are removed from the collection. Rejected - Error message.

Returns an empty object.

Status/Error Codes

Was this helpful?

Remove products from a product collection

Copy Code
1/*******************************
2 * Backend code - products.jsw *
3 *******************************/
4
5import wixStoresBackend from 'wix-stores-backend';
6
7export function removeProductsFromCollection(collectionId, productIds) {
8 return wixStoresBackend.removeProductsFromCollection(collectionId, productIds);
9}
10
11/*************
12 * Page code *
13 *************/
14
15import { removeProductsFromCollection } from 'backend/products';
16
17// ...
18
19const collectionId = ... // get collection ID
20const productIds = ["id1", "id2", "id3"];
21
22removeProductsFromCollection(collectionId, productIds)
23 .then(() => {
24 // products removed from the collection
25 })
26 .catch((error) => {
27 // products not removed from the collection
28 });