> 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: bulkUpdateOrders(orders: Array, options: BulkUpdateOrdersOptions) # Method package: wixEcomBackend # Method menu location: wixEcomBackend --> orders --> bulkUpdateOrders # Method Link: https://dev.wix.com/docs/velo/apis/wix-ecom-backend/orders/bulk-update-orders.md # Method Description: Updates up to 100 orders. The `bulkUpdateOrders()` function returns a Promise that resolves when the specified orders' information is updated. Currently, the following fields can be updated: + `order.buyerInfo.email` + `order.buyerLanguage` + `order.weightUnit` + `order.billingInfo.address` + `order.billingInfo.contactDetails` + `order.archived` + `order.attributionSource` + `order.seenByAHuman` + `order.recipientInfo.address` + `order.recipientInfo.contactDetails` + `order.shippingInfo.logistics.shippingDestination.address` + `order.shippingInfo.logistics.shippingDestination.contactDetails` To update a field's value, include the new value in the `orders.order` object in the method parameters. To remove a field's value, pass `null`. > **Note:** Removing `buyerInfo` or `contactDetails` fields results in an error. To update an order's payment status, use [`updatePaymentStatus( )`](https://www.wix.com/velo/reference/wix-ecom-backend/ordertransactions/updatepaymentstatus). # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Update multiple orders (Dashboard Page) ```javascript import { orders } from "wix-ecom-backend"; /* Sample ordersToUpdate value: * [ * { * order: { * id: 'efc0f204-d83a-4391-b576-e9cf816f6bc9', * archived: true * } * }, * { * order: { * id: '6bfb7f73-3269-41d6-b396-64f6bb5947ff', * archived: true * } * } * ] */ /* Sample options value: * { returnEntity: false } */ export async function myBulkUpdateOrders(ordersToUpdate, options) { try { const bulkUpdateOrdersResponse = await orders.bulkUpdateOrders(ordersToUpdate, options); console.log("Bulk update orders response:", bulkUpdateOrdersResponse); return bulkUpdateOrdersResponse; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * { * "results": [ * { * "itemMetadata": { * "id": "efc0f204-d83a-4391-b576-e9cf816f6bc9", * "originalIndex": 0, * "success": true * } * }, * { * "itemMetadata": { * "id": "6bfb7f73-3269-41d6-b396-64f6bb5947ff", * "originalIndex": 1, * "success": true * } * } * ], * "bulkActionMetadata": { * "totalSuccesses": 2, * "totalFailures": 0, * "undetailedFailures": 0 * } * } */ ``` ## Updates multiple orders (Backend) ```javascript import { orders } from "wix-ecom-backend"; import { elevate } from "wix-auth"; /* Sample orders value: * [ * { * order: { * id: 'efc0f204-d83a-4391-b576-e9cf816f6bc9', * archived: true * } * }, * { * order: { * id: '6bfb7f73-3269-41d6-b396-64f6bb5947ff', * archived: true * } * } * ] */ /* Sample options value: * { returnEntity: false } */ const myElevatedFunction = await elevate(orders.bulkUpdateOrders); export async function myBulkUpdateOrders(ordersToUpdate, options) { try { const bulkUpdateOrdersResponse = await orders.bulkUpdateOrders(ordersToUpdate, options); console.log("Bulk update orders response:", bulkUpdateOrdersResponse); return bulkUpdateOrdersResponse; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * { * "results": [ * { * "itemMetadata": { * "id": "efc0f204-d83a-4391-b576-e9cf816f6bc9", * "originalIndex": 0, * "success": true * } * }, * { * "itemMetadata": { * "id": "6bfb7f73-3269-41d6-b396-64f6bb5947ff", * "originalIndex": 1, * "success": true * } * } * ], * "bulkActionMetadata": { * "totalSuccesses": 2, * "totalFailures": 0, * "undetailedFailures": 0 * } * } */ ``` ## Updates multiple orders from input on the site's page (Backend to Page Code) ```javascript /***************************************** * Backend code - bulk-update-orders.web.js * ****************************************/ import {Permissions, webMethod} from "wix-web-module"; import {orders} from "wix-ecom-backend"; import {elevate} from "wix-auth"; const myElevatedFunction = await elevate(orders.bulkUpdateOrders) export const myBulkUpdateOrdersFunction = webMethod( Permissions.Anyone, async (ordersUpdateInfo, options) => { try { const updatedOrders = await myElevatedFunction(ordersUpdateInfo, options); return updatedOrders; } catch (error) { console.error(error); throw new Error(error); } }, ); /************* * Page code * ************/ import {myBulkUpdateOrdersFunction} from "backend/create-location.web"; $w.onReady(() => { $w("#bulkUpdateOrdersBtn").onClick(async () => { const ordersUpdateInfo = [ { order: { id: 'efc0f204-d83a-4391-b576-e9cf816f6bc9', archived: true }, }, { order: { id: '6bfb7f73-3269-41d6-b396-64f6bb5947ff', archived: true }, }, ]; const options = { returnEntity: false }; const updatedOrders = await myBulkUpdateOrdersFunction(ordersUpdateInfo, options); console.log("You have successfully updated multiple orders.\n", updatedOrders); $w("#updatedOrdersSuccessMsg").show(); }); }); ``` ---