> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: addProductsToCollection(collectionId: string, productIds: Array) # Method package: wixStoresBackend # Method menu location: wixStoresBackend --> addProductsToCollection # Method Link: https://dev.wix.com/docs/velo/apis/wix-stores-backend/add-products-to-collection.md # Method Description: 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()`](#createProduct) to add a product to the store. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Add products to a product collection ```javascript /******************************* * Backend code - products.jsw * *******************************/ import wixStoresBackend from 'wix-stores-backend'; export function addProductsToCollection(collectionId, productIds) { return wixStoresBackend.addProductsToCollection(collectionId, productIds); } /************* * Page code * *************/ import { addProductsToCollection } from 'backend/products'; // ... const collectionId = ... // get collection ID const productIds = ["id1", "id2", "id3"]; addProductsToCollection(collectionId, productIds) .then(() => { // products added to the collection }) .catch((error) => { // products not added to the collection }); ``` ---