bulkUpdateOrders( )


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( ).

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage eCommerce - all permissions
Manage Stores - all permissions
Manage Orders
Manage Restaurants - all permissions
Learn more about app permissions.
Method Declaration
Copy
function bulkUpdateOrders(
  orders: Array<MaskedOrder>,
  options: BulkUpdateOrdersOptions,
): Promise<BulkUpdateOrdersResponse>;
Method Parameters
ordersArray<MaskedOrder>Required

Orders to update.


optionsBulkUpdateOrdersOptions
Returns
Return Type:Promise<BulkUpdateOrdersResponse>

Bulk updates archived status for 2 orders.

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 * } * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?