> 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: bulkUpdateProductProperty(ids: Array, set: BulkUpdateProperties) # Method package: wixStoresBackend # Method menu location: wixStoresBackend --> bulkUpdateProductProperty # Method Link: https://dev.wix.com/docs/velo/apis/wix-stores-backend/bulk-update-product-property.md # Method Description: Updates a property for up to 100 products at a time. The `bulkUpdateProductProperty()` function returns a Promise that resolves when the property of the products have been updated. The properties that can be bulk-updated are detailed in the `set` object in the parameters section below. > **Note:** Do not pass important information from client-side code. Doing so opens a vulnerability that a malicious user can exploit to change information, such as a buyer’s personal details (address, email, etc.) or product price information. To learn more about how to keep your code secure, see [Security Considerations When Working with Wix Code](https://support.wix.com/en/article/velo-security-best-practices#code-visibility). # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Update the price of multiple products ```javascript /************************************** * Backend code - my-backend-file.jsw * **************************************/ import wixStoresBackend from 'wix-stores-backend'; export async function myBulkUpdateProductPropertyFunction(ids, set) { try { const productUpdateResults = await wixStoresBackend.bulkUpdateProductProperty(ids, set); console.log('Bulk action results:', productUpdateResults); return productUpdateResults; } catch (error) { console.error(error); // Handle the error } } /************* * Page code * *************/ import { myBulkUpdateProductPropertyFunction } from 'backend/my-backend-file'; // Sample product IDs: const ids = [ "bb6ddd51-7295-4fc8-8a4f-2521485c738d", "c36bbdbe-fbf8-4a43-810e-a0abdffe70ae", "2966543c-2b2f-4ca1-862c-6a04736c1063", "c9adb138-96f8-4f08-8626-9fef2445c490", "4ed1aa2c-c441-4e3f-8e57-a18886bf52bb" ] // Set the price to 10.25 const set = { "price": 10.25 } myBulkUpdateProductPropertyFunction(ids, set) .then((productUpdateResults) => { console.log('Bulk action results:', productUpdateResults); return productUpdateResults; }) .catch((error) => { console.error(error); // Handle the error }); /* Promise resolves to: * * { * "results": [ * {"itemMetadata": { * "id": "bb6ddd51-7295-4fc8-8a4f-2521485c738d", * "originalIndex": 0, * "success": true * }}, * {"itemMetadata": { * "id": "c36bbdbe-fbf8-4a43-810e-a0abdffe70ae", * "originalIndex": 1, * "success": true * }}, * {"itemMetadata": { * "id": "2966543c-2b2f-4ca1-862c-6a04736c1063", * "originalIndex": 2, * "success": true * }}, * {"itemMetadata": { * "id": "c9adb138-96f8-4f08-8626-9fef2445c490", * "originalIndex": 3, * "success": true * }}, * {"itemMetadata": { * "id": "4ed1aa2c-c441-4e3f-8e57-a18886bf52bb", * "originalIndex": 4, * "success": true * }} * ], * "bulkActionMetadata": { * "totalSuccesses": 5, * "totalFailures": 0, * "undetailedFailures": 0 * } * } * */ ``` ## Update the ribbon property of multiple products ```javascript /************************************** * Backend code - my-backend-file.jsw * **************************************/ import wixStoresBackend from 'wix-stores-backend'; export async function myBulkUpdateProductPropertyFunction(ids, set) { try { const productUpdateResults = await wixStoresBackend.bulkUpdateProductProperty(ids, set); console.log('Bulk action results:', productUpdateResults); return productUpdateResults; } catch (error) { console.error(error); // Handle the error } } /************* * Page code * *************/ import { myBulkUpdateProductPropertyFunction } from 'backend/my-backend-file'; // Sample product IDs: const ids = [ "bb6ddd51-7295-4fc8-8a4f-2521485c738d", "c36bbdbe-fbf8-4a43-810e-a0abdffe70ae", "2966543c-2b2f-4ca1-862c-6a04736c1063" ] // Set the ribbon to "On Sale" const set = { "ribbon": "On Sale" } myBulkUpdateProductPropertyFunction(ids, set) .then((productUpdateResults) => { console.log('Bulk action results:', productUpdateResults); return productUpdateResults; }) .catch((error) => { console.error(error); // Handle the error }); /* Promise resolves to: * * { * "results": [ * {"itemMetadata": { * "id": "bb6ddd51-7295-4fc8-8a4f-2521485c738d", * "originalIndex": 0, * "success": true * }}, * {"itemMetadata": { * "id": "c36bbdbe-fbf8-4a43-810e-a0abdffe70ae", * "originalIndex": 1, * "success": true * }}, * {"itemMetadata": { * "id": "2966543c-2b2f-4ca1-862c-6a04736c1063", * "originalIndex": 2, * "success": true * }} * ], * "bulkActionMetadata": { * "totalSuccesses": 3, * "totalFailures": 0, * "undetailedFailures": 0 * } * } * */ ``` ## Attempt to update the weight of multiple products ```javascript /************************************** * Backend code - my-backend-file.jsw * **************************************/ import wixStoresBackend from 'wix-stores-backend'; export async function myBulkUpdateProductPropertyFunction(ids, set) { try { const productUpdateResults = await wixStoresBackend.bulkUpdateProductProperty(ids, set); console.log('Bulk action results:', productUpdateResults); return productUpdateResults; } catch (error) { console.error(error); // Handle the error } } /************* * Page code * *************/ import { myBulkUpdateProductPropertyFunction } from 'backend/my-backend-file'; // Sample product IDs: const ids = [ "bb6ddd51-7295-4fc8-8a4f-2521485c738d", "4deb9c8d-7aba-45e1-9d83-bf99b479b5bb" ] // Set the weight to 2.64 const set = { "weight": "2.64" } myBulkUpdateProductPropertyFunction(ids, set) .then((productUpdateResults) => { console.log('Bulk action results:', productUpdateResults); return productUpdateResults; }) .catch((error) => { console.error(error); // Handle the error }); /* Promise resolves to: * * { * "results": [ * {"itemMetadata": { * "id": "bb6ddd51-7295-4fc8-8a4f-2521485c738d", * "originalIndex": 0, * "success": true * }}, * {"itemMetadata": { * "id": "4deb9c8d-7aba-45e1-9d83-bf99b479b5bb", * "originalIndex": 1, * "success": false, * "error": { * "code": "PRODUCT_NOT_FOUND", * "description": "Product is not found" * } * }} * ], * "bulkActionMetadata": { * "totalSuccesses": 1, * "totalFailures": 1, * "undetailedFailures": 0 * } * } * */ ``` ---