addProductsToCollection( )


Adds products by ID to a product collection.

The addProductsToCollection() function returns a Promise that resolves when the products with the given IDs are added to a product collection with a given ID.

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

With this function, you can only add existing products to a collection. You cannot use the addProductsToCollection() function to create a product. See createProduct() to add a product to the store.

Method Declaration
Copy
Method Parameters
collectionIdstringRequired

ID of the product collection to which to add products.


productIdsArray<string>Required

IDs of the products to add to the product collection, separated by commas.

Errors

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

Did this help?