> 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 # BulkUpdateProducts # Package: catalogV1 # Namespace: CatalogWriteApi # Method link: https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/catalog/bulk-update-product-property.md ## Permission Scopes: Manage Products: SCOPE.DC-STORES.MANAGE-PRODUCTS ## Introduction Updates a specified property for up to 100 products at a time. --- ## REST API ### Schema ``` Method: bulkUpdateProducts Description: Updates a specified property for up to 100 products at a time. URL: https://www.wixapis.com/stores/v1/bulk/products/update 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: ids | type: array | description: Product GUIDs. | required: true param name: set | type: SetValue - ONE-OF: - name: price | type: number | description: Set 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, variant prices will be calculated according to the set product price. If variant price is negative after setting new price, the update will fail. - name: cost | type: number | description: Set 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 set per variant. - name: weight | type: number | description: Set 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 set per variant. - name: ribbon | type: string | description: Set product ribbon. Pass empty string to remove existing ribbon. - name: brand | type: string | description: Set product brand. Pass empty string to remove existing brand. Return type: BulkUpdateProductsResponse - 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 ### Update the brand of 1 product ```curl curl -X POST \ https://www.wixapis.com/stores/v1/bulk/products/update \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "ids": [ "bb6ddd51-7295-4fc8-8a4f-2521485c738d" ], "set": { "brand": "Nice" } }' ``` ### Update the price of 5 products ```curl curl -X POST \ https://www.wixapis.com/stores/v1/bulk/products/update \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "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": { "price": 10.25 } }' ``` ### Update the cost of 3 products ```curl curl -X POST \ https://www.wixapis.com/stores/v1/bulk/products/update \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "ids": [ "80a584c3-78c1-4e2f-84f8-b8d0bf65b518", "e5419878-8284-4f02-98bb-087e1d8dc781", "cc30ba06-2b9a-4962-8b34-7a265d495d7e" ], "set": { "cost": 2 } }' ``` ### Partially update the weight of 2 products 1 product was found and successfully updated, while the other product was not found ```curl curl -X POST \ https://www.wixapis.com/stores/v1/bulk/products/update \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "ids": [ "bb6ddd51-7295-4fc8-8a4f-2521485c738d", "4deb9c8d-7aba-45e1-9d83-bf99b479b5bb" ], "set": { "weight": "2.64" } }' ``` ### Update the ribbon of 1 product ```curl curl -X POST \ https://www.wixapis.com/stores/v1/bulk/products/update \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "ids": [ "bb6ddd51-7295-4fc8-8a4f-2521485c738d" ], "set": { "ribbon": "Sale" } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.catalogV1.CatalogWriteApi.bulkUpdateProducts(ids, set) Description: Updates a specified property for up to 100 products at a time. # 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: ids | type: array | description: Product GUIDs. | required: true param name: set | type: SetValue | required: true - ONE-OF: - required: true - name: price | type: number | description: Set 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, variant prices will be calculated according to the set product price. If variant price is negative after setting new price, the update will fail. - name: cost | type: number | description: Set 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 set per variant. - name: weight | type: number | description: Set 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 set per variant. - name: ribbon | type: string | description: Set product ribbon. Pass empty string to remove existing ribbon. - name: brand | type: string | description: Set product brand. Pass empty string to remove existing brand. 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 update the weight of multiple products In this example, the second product ID is not found, so an error is returned for that update action. ```javascript /************************************** * Backend code - my-backend-file.web.js/ts * **************************************/ import { Permissions, webMethod } from '@wix/web-methods'; import { products } from '@wix/stores'; export const myBulkUpdateProductPropertyFunction = webMethod(Permissions.Anyone, async (ids, set) => { try { const productUpdateResults = await products.bulkUpdateProductsProperty(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.web'; // 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 * } * } * */ ``` ### Update the ribbon property of multiple products ```javascript /************************************** * Backend code - my-backend-file.web.js/ts * **************************************/ import { Permissions, webMethod } from '@wix/web-methods'; import { products } from '@wix/stores'; export const myBulkUpdateProductPropertyFunction = webMethod(Permissions.Anyone, async (ids, set) => { try { const productUpdateResults = await products.bulkUpdateProductsProperty(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.web'; // 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:', { results: productUpdateResults.results.map(result => ({ itemMetadata: { _id: result.itemMetadata._id, originalIndex: result.itemMetadata.originalIndex, success: result.itemMetadata.success } })), bulkActionMetadata: { totalSuccesses: productUpdateResults.bulkActionMetadata.totalSuccesses, totalFailures: productUpdateResults.bulkActionMetadata.totalFailures, undetailedFailures: productUpdateResults.bulkActionMetadata.undetailedFailures } }); 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 * } * } * */ ``` ### Update the price of multiple products ```javascript /************************************** * Backend code - my-backend-file.web.js/ts * **************************************/ import { Permissions, webMethod } from '@wix/web-methods'; import { products } from '@wix/stores'; export const myBulkUpdateProductPropertyFunction = webMethod(Permissions.Anyone, async (ids, set) => { try { const productUpdateResults = await products.bulkUpdateProductsProperty(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.web'; // 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 * } * } * */ ``` ### bulkUpdateProductsProperty (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 bulkUpdateProductsProperty(ids,set) { const response = await myWixClient.products.bulkUpdateProductsProperty(ids,set); }; ``` ---