Updates an order.
The updateOrder()
function returns a Promise that resolves when the specified order's 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 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( )
.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function updateOrder(
_id: string,
order: UpdateOrder,
options: UpdateOrderOptions,
): Promise<Order>;
Order ID.
import { orders } from "wix-ecom-backend";
async function updateOrder(id, order, options) {
try {
const result = await orders.updateOrder(id, order, options);
return result;
} catch (error) {
console.error(error);
// Handle the error
}
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.