updateOrder( )
Updates an order.
Description
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.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 body params.
To remove a field's value, pass null
.
Note: Removing
buyerInfo
orcontactDetails
fields results in an error.
To update an order's payment status, use updatePaymentStatus( )
.
This function requires elevated permissions to run. This function is not universal and runs only on the backend.
Syntax
function updateOrder(_id: string, order: UpdateOrder): Promise<Order>
updateOrder Parameters
NAME
TYPE
DESCRIPTION
Order ID.
Returns
Newly created order.
Return Type:
NAME
TYPE
DESCRIPTION
Date and time the order was created.
Order ID.
Order activities.
Additional fees applied to the order.
Applied discounts.
Whether order is archived.
Order attribution source.
Balance summary.
Billing address and contact details.
Buyer information.
Language for communication with the buyer. Defaults to the site language. For a site that supports multiple languages, this is the language the buyer selected.
Information about the sales channel that submitted this order.
Checkout ID.
ID of the order's initiator.
Custom fields.
Custom field data for the order object.
Extended fields must be configured in the Wix Dev Center before they can be accessed with API calls.
Order fulfillment status.
Order line items.
Order number displayed in the site owner's dashboard (auto-generated).
Order payment status.
NOT_PAID
- This can be an order made online, but not yet paid. In such casesorder.status
will beINITIALIZED
.- This status also applies when an offline order needs to be manually marked as paid. In such cases
order.status
will beAPPROVED
. PAID
- All payments associated with this order are paid. For online payments:payment.regularPaymentDetails.status: APPROVED
. For gift cards:payment.giftCardPaymentDetails.voided: false
.PARTIALLY_REFUNDED
- Order was refunded, but refund amount is less than order total price.FULLY_REFUNDED
- Order fully refunded. Refund amount equals total price.PENDING
- Payments received but not yet confirmed by the payment provider.PARTIALLY_PAID
- At least one payment was received and approved, covering less than total price amount.
Order price summary.
Persistent ID that correlates between the various eCommerce elements: cart, checkout, and order.
Order recipient address and contact details.
This field may differ from the address in shippingInfo.logistics
when:
- The chosen shipping option is pickup point or store pickup.
- No shipping option is selected.
Whether a human has seen the order. Set when an order is clicked on in the dashboard.
Shipping info and selected shipping option details.
Site language in which original values are shown.
Order status.
INITIALIZED
- Order was created, but not yet approved or declined.APPROVED
- Order was approved. This happens when either the online payment succeeded or the order is an offline order. Once an order is approved, many side effects are triggered. For example, holding of stock in the inventory and sending of notification emails.CANCELED
- Order was canceled by the user.
Whether tax is included in line item prices.
Tax summary.
Weight measurement unit - defaults to site's weight unit.
Was this helpful?
updateOrder example
1import { orders } from 'wix-ecom-backend';23 async function updateOrder(id, order, options) {4 try {5 const result = await orders.updateOrder(id, order, options);67 return result;8 } catch (error) {9 console.error(error);10 // Handle the error11 }12 }13