> 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: bulkAdjustProductProperty(ids: Array, adjust: BulkAdjustProperties) # Method package: wixStoresBackend # Method menu location: wixStoresBackend --> bulkAdjustProductProperty # Method Link: https://dev.wix.com/docs/velo/apis/wix-stores-backend/bulk-adjust-product-property.md # Method Description: Adjusts a numeric property for up to 100 products at a time. The `bulkAdjustProductProperty()` function returns a Promise that resolves when the property of the products have been adjusted. A property can be increased or decreased either by percentage or amount. The properties that can be bulk-adjusted are detailed in the `adjust` 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. ## Adjust the weight of multiple products by amount ```javascript /************************************** * Backend code - my-backend-file.jsw * **************************************/ import wixStoresBackend from 'wix-stores-backend'; export async function myBulkAdjustProductPropertyFunction(ids, adjust) { try { const productAdjustmentResults = await wixStoresBackend.bulkAdjustProductProperty(ids, adjust); console.log('Bulk action results:', productAdjustmentResults); return productAdjustmentResults; } catch (error) { console.error(error); // Handle the error } } /************* * Page code * *************/ import { myBulkAdjustProductPropertyFunction } from 'backend/my-backend-file'; // Sample product IDs: const ids = [ "91f7ac8b-2baa-289c-aa50-6d64764f35d3", "0614129c-8777-9f3b-4dfe-b80a54df10d5" ] // Increase the weight by 10 const adjust = { "weight": { "amount": 10 } } myBulkAdjustProductPropertyFunction(ids, adjust) .then((productAdjustmentResults) => { console.log('Bulk action results:', productAdjustmentResults); return productAdjustmentResults; }) .catch((error) => { console.error(error); // Handle the error }); /* Promise resolves to: * * { * "results": [ * { * "itemMetadata": { * "_id": "91f7ac8b-2baa-289c-aa50-6d64764f35d3", * "originalIndex": 0, * "success": true * } * }, * { * "itemMetadata": { * "_id": "0614129c-8777-9f3b-4dfe-b80a54df10d5", * "originalIndex": 1, * "success": true * } * } * ], * "bulkActionMetadata": { * "totalSuccesses": 2, * "totalFailures": 0, * "undetailedFailures": 0 * } * } * */ ``` ## Adjust the cost of multiple products by percentage ```javascript /************************************** * Backend code - my-backend-file.jsw * **************************************/ import wixStoresBackend from 'wix-stores-backend'; export async function myBulkAdjustProductPropertyFunction(ids, adjust) { try { const productAdjustmentResults = await wixStoresBackend.bulkAdjustProductProperty(ids, adjust); console.log('Bulk action results:', productAdjustmentResults); return productAdjustmentResults; } catch (error) { console.error(error); // Handle the error } } /************* * Page code * *************/ import { myBulkAdjustProductPropertyFunction } from 'backend/my-backend-file'; // Sample product IDs: const ids = [ "91f7ac8b-2baa-289c-aa50-6d64764f35d3", "0614129c-8777-9f3b-4dfe-b80a54df10d5" ] // Increase the price by 20 percent const adjust = { "cost": { "percentage": { "roundToInt": true, "rate": 20 } } } myBulkAdjustProductPropertyFunction(ids, adjust) .then((productAdjustmentResults) => { console.log('Bulk action results:', productAdjustmentResults); return productAdjustmentResults; }) .catch((error) => { console.error(error); // Handle the error }); /* Promise resolves to: * * { * "results": [ * { * "itemMetadata": { * "_id": "91f7ac8b-2baa-289c-aa50-6d64764f35d3", * "originalIndex": 0, * "success": true * } * }, * { * "itemMetadata": { * "_id": "0614129c-8777-9f3b-4dfe-b80a54df10d5", * "originalIndex": 1, * "success": true * } * } * ], * "bulkActionMetadata": { * "totalSuccesses": 2, * "totalFailures": 0, * "undetailedFailures": 0 * } * } * */ ``` ## Attempt to adjust the price of multiple products by amount ```javascript /************************************** * Backend code - my-backend-file.jsw * **************************************/ import wixStoresBackend from 'wix-stores-backend'; export async function myBulkAdjustProductPropertyFunction(ids, adjust) { try { const productAdjustmentResults = await wixStoresBackend.bulkAdjustProductProperty(ids, adjust); console.log('Bulk action results:', productAdjustmentResults); return productAdjustmentResults; } catch (error) { console.error(error); // Handle the error } } /************* * Page code * *************/ import { myBulkAdjustProductPropertyFunction } from 'backend/my-backend-file'; // Sample product IDs: const ids = [ "91f7ac8b-2baa-289c-aa50-6d64764f35d3", "0614129c-8777-9f3b-4dfe-b80a54df10d5" ] // Decrease the price by 30 const adjust = { "price": { "amount": -30 } } myBulkAdjustProductPropertyFunction(ids, adjust) .then((productAdjustmentResults) => { console.log('Bulk action results:', productAdjustmentResults); return productAdjustmentResults; }) .catch((error) => { console.error(error); // Handle the error }); /* Promise resolves to: * * { * "results": [ * { * "itemMetadata": { * "_id": "91f7ac8b-2baa-289c-aa50-6d64764f35d3", * "originalIndex": 0, * "success": false, * "error": { * "code": "PRODUCT_ADJUSTMENT_PRICE_OUT_OF_RANGE", * "description": "Product/variant price must be between 0 and 999999999.99 after adjustment" * } * } * }, * { * "itemMetadata": { * "_id": "0614129c-8777-9f3b-4dfe-b80a54df10d5", * "originalIndex": 1, * "success": false, * "error": { * "code": "PRODUCT_ADJUSTMENT_PRICE_OUT_OF_RANGE", * "description": "Product/variant price must be between 0 and 999999999.99 after adjustment" * } * } * } * ], * "bulkActionMetadata": { * "totalSuccesses": 0, * "totalFailures": 2, * "undetailedFailures": 0 * } * } * */ ``` ---