> 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 # BulkAdjustProductProperties # Package: catalogV1 # Namespace: CatalogWriteApi # Method link: https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/catalog/bulk-adjust-product-properties.md ## Permission Scopes: Manage Products: SCOPE.DC-STORES.MANAGE-PRODUCTS ## Introduction Adjusts a specified numerical property for up to 100 products at a time. The property can be increased or decreased either by percentage or amount. --- ## REST API ### Schema ``` Method: bulkAdjustProductProperties Description: Adjusts a specified numerical property for up to 100 products at a time. The property can be increased or decreased either by percentage or amount. URL: https://www.wixapis.com/stores/v1/bulk/products/adjust-properties Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: ids Method parameters: param name: adjust | type: AdjustValue - ONE-OF: - name: price | type: PropertyAdjustmentData | description: Adjust product price. If [variant management](https://support.wix.com/en/article/wix-stores-adding-and-customizing-product-options#setting-different-prices-for-variants) is enabled, variants prices will be calculated according to the adjusted price. If variant price is negative after the adjustment, the update will fail. - ONE-OF: - name: percentage | type: PercentageData | description: Adjust by percentage. - name: roundToInt | type: boolean | description: If `true`, result will be rounded to the nearest whole number. If `false`, result will be rounded to 2 places after the decimal point. - name: rate | type: integer | description: Percentage value, as a whole number (integer) between `-100` and `1000`. For example: + Pass `100` to increase value by 100% (multiply original value by 2). + Pass `1000` to increase value by 1000% (multiply original value by 10). + Pass `-50` to decrease value by 50% (original value is halved). - name: amount | type: number | description: Adjust by amount. - name: cost | type: PropertyAdjustmentData | description: Adjust product cost of goods. If [variant management](https://support.wix.com/en/article/wix-stores-adding-and-customizing-product-options#setting-different-prices-for-variants) is enabled, cost of goods will be adjusted per variant. - name: weight | type: PropertyAdjustmentData | description: Adjust product weight. If [variant management](https://support.wix.com/en/article/wix-stores-adding-and-customizing-product-options#setting-different-prices-for-variants) is enabled, weight will be adjusted per variant. param name: ids | type: array | description: Product GUIDs. | required: true Return type: BulkAdjustProductPropertiesResponse - name: results | type: array | description: Bulk action results. - name: itemMetadata | type: ItemMetadata | description: Item metadata. - name: id | type: string | description: Item GUID. Should always be available, unless it's impossible (for example, when failing to create an item). - name: originalIndex | type: integer | description: Index of the item within the request array. Allows for correlation between request and response items. - name: success | type: boolean | description: Whether the requested action was successful for this item. When `false`, the `error` field is populated. - name: error | type: ApplicationError | description: Details about the error in case of failure. - name: code | type: string | description: Error code. - name: description | type: string | description: Description of the error. - name: data | type: object | description: Data related to the error. - name: bulkActionMetadata | type: BulkActionMetadata | description: Bulk action metadata. - name: totalSuccesses | type: integer | description: Number of items that were successfully processed. - name: totalFailures | type: integer | description: Number of items that couldn't be processed. - name: undetailedFailures | type: integer | description: Number of failures without details because detailed failure threshold was exceeded. ``` ### Examples ### Adjust the price of 3 products by amount ```curl curl -X POST \ https://www.wixapis.com/stores/v1/bulk/products/adjust-properties \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "ids": [ "80a584c3-78c1-4e2f-84f8-b8d0bf65b518", "e5419878-8284-4f02-98bb-087e1d8dc781", "cc30ba06-2b9a-4962-8b34-7a265d495d7e" ], "adjust": { "price": { "amount": 30 } } }' ``` ### Adjust the price of 2 products by percentage ```curl curl -X POST \ https://www.wixapis.com/stores/v1/bulk/products/adjust-properties \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "ids": [ "bfcafbe6-b671-4ebe-8e3d-49f242cef188", "e5419878-8284-4f02-98bb-087e1d8dc781" ], "adjust": { "price": { "percentage": { "roundToInt": false, "rate": 200 } } } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.catalogV1.CatalogWriteApi.bulkAdjustProductProperties(adjust, ids) Description: Adjusts a specified numerical property for up to 100 products at a time. The property can be increased or decreased either by percentage or amount. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: ids Method parameters: param name: adjust | type: AdjustValue | required: true - ONE-OF: - required: true - name: price | type: PropertyAdjustmentData | description: Adjust product price. If [variant management](https://support.wix.com/en/article/wix-stores-adding-and-customizing-product-options#setting-different-prices-for-variants) is enabled, variants prices will be calculated according to the adjusted price. If variant price is negative after the adjustment, the update will fail. - ONE-OF: - name: percentage | type: PercentageData | description: Adjust by percentage. - name: roundToInt | type: boolean | description: If `true`, result will be rounded to the nearest whole number. If `false`, result will be rounded to 2 places after the decimal point. - name: rate | type: integer | description: Percentage value, as a whole number (integer) between `-100` and `1000`. For example: + Pass `100` to increase value by 100% (multiply original value by 2). + Pass `1000` to increase value by 1000% (multiply original value by 10). + Pass `-50` to decrease value by 50% (original value is halved). - name: amount | type: number | description: Adjust by amount. - name: cost | type: PropertyAdjustmentData | description: Adjust product cost of goods. If [variant management](https://support.wix.com/en/article/wix-stores-adding-and-customizing-product-options#setting-different-prices-for-variants) is enabled, cost of goods will be adjusted per variant. - name: weight | type: PropertyAdjustmentData | description: Adjust product weight. If [variant management](https://support.wix.com/en/article/wix-stores-adding-and-customizing-product-options#setting-different-prices-for-variants) is enabled, weight will be adjusted per variant. param name: ids | type: array | description: Product GUIDs. | required: true Return type: PROMISE - name: results | type: array | description: Bulk action results. - name: itemMetadata | type: ItemMetadata | description: Item metadata. - name: _id | type: string | description: Item GUID. Should always be available, unless it's impossible (for example, when failing to create an item). - name: originalIndex | type: integer | description: Index of the item within the request array. Allows for correlation between request and response items. - name: success | type: boolean | description: Whether the requested action was successful for this item. When `false`, the `error` field is populated. - name: error | type: ApplicationError | description: Details about the error in case of failure. - name: code | type: string | description: Error code. - name: description | type: string | description: Description of the error. - name: data | type: object | description: Data related to the error. - name: bulkActionMetadata | type: BulkActionMetadata | description: Bulk action metadata. - name: totalSuccesses | type: integer | description: Number of items that were successfully processed. - name: totalFailures | type: integer | description: Number of items that couldn't be processed. - name: undetailedFailures | type: integer | description: Number of failures without details because detailed failure threshold was exceeded. ``` ### Examples ### Attempt to adjust the price of multiple products by amount In this example, an error is returned as the resulting product price is below 0. ```javascript /************************************** * Backend code - my-backend-file.web.js/ts * **************************************/ import { Permissions, webMethod } from '@wix/web-methods'; import { products } from '@wix/stores'; export const myBulkAdjustProductPropertyFunction = webMethod(Permissions.Anyone, async (adjust, ids) => { try { const productAdjustmentResults = await products.bulkAdjustProductProperty(adjust, ids); 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.web'; // 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(adjust, ids) .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 * } * } * */ ``` ### Adjust the cost of multiple products by percentage ```javascript /************************************** * Backend code - my-backend-file.web.js/ts * **************************************/ import { Permissions, webMethod } from '@wix/web-methods'; import { products } from '@wix/stores'; export const myBulkAdjustProductPropertyFunction = webMethod(Permissions.Anyone, async (adjust, ids) => { try { const productAdjustmentResults = await products.bulkAdjustProductProperty(adjust, ids); 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.web'; // Sample product IDs: const ids = [ "91f7ac8b-2baa-289c-aa50-6d64764f35d3", "0614129c-8777-9f3b-4dfe-b80a54df10d5" ] // Increase the cost by 20 percent const adjust = { "cost": { "percentage": { "rate": 20, "roundToInt": true } } } myBulkAdjustProductPropertyFunction(adjust, ids) .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 weight of multiple products by amount ```javascript /************************************** * Backend code - my-backend-file.web.js/ts * **************************************/ import { Permissions, webMethod } from '@wix/web-methods'; import { products } from '@wix/stores'; export const myBulkAdjustProductPropertyFunction = webMethod(Permissions.Anyone, async (adjust, ids) => { try { const productAdjustmentResults = await products.bulkAdjustProductProperty(adjust, ids); 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.web'; // 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(adjust, ids) .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 * } * } * */ ``` ### bulkAdjustProductProperty (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { products } from '@wix/stores'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { products }, // Include the auth strategy and host as relevant }); async function bulkAdjustProductProperty(adjust,ids) { const response = await myWixClient.products.bulkAdjustProductProperty(adjust,ids); }; ``` ---