Search.../

updateCollection( )

Developer Preview

Updates specified properties of a collection. To add products to a collection, call the addProductsToCollection function.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function updateCollection(_id: string, collection: UpdateCollection): Promise<UpdateCollectionResponse>

updateCollection Parameters

NAME
TYPE
DESCRIPTION
_id
string

Collection ID (generated automatically by the catalog).

collection
UpdateCollection

Collection info to update.

Returns

Return Type:

Promise<
UpdateCollectionResponse
>
NAME
TYPE
DESCRIPTION
collection
Collection

Updated collection.

Was this helpful?

updateCollection example

Copy Code
1import { products } from 'wix-stores.v2';
2
3 async function updateCollection(id, collection) {
4 try {
5 const result = await products.updateCollection(id, collection);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13