Search.../

updateFulfillment( )

Updates a fulfillment's properties. To update a field's value, include the new value in the fulfillment field in the body params. To remove a field's value, pass null.

Description

The updateFulfillment() function returns a Promise that resolves when the fulfillment is updated.

Note: Updating line item IDs or fulfilled quantities is not allowed. To update line item IDs or quantities, delete the fulfillment and create it again.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function updateFulfillment(identifiers: UpdateFulfillmentIdentifiers, options: UpdateFulfillmentOptions): Promise<OrderWithFulfillments>

updateFulfillment Parameters

NAME
TYPE
DESCRIPTION
identifiers
UpdateFulfillmentIdentifiers

Order and fulfillment IDs to be updated.

options
Optional
UpdateFulfillmentOptions

Available options to use when updating a fulfillment.

Returns

Order ID and the orders' associated fulfillments after update.

Return Type:

Promise<
OrderWithFulfillments
>
NAME
TYPE
DESCRIPTION
fulfillments
Array<
Fulfillment
>

Fulfillments associated with the order.

orderId
string

Order ID.

Was this helpful?

Update a fulfillment

Updates the fulfillment's trackingNumber

Copy Code
1import { orderFulfillments } from 'wix-ecom-backend';
2
3/* Sample identifiers value:
4 * {
5 * orderId: 'a6c3a817-579d-4cb5-8521-2fe53b2c4bf1',
6 * fulfillmentId: 'a838877d-3f13-49f3-ab29-1cde478e0949'
7 * };
8 *
9 * Sample options value:
10 * {
11 * fulfillment: {
12 * trackingInfo: {
13 * trackingNumber: '45677'
14 * }
15 * }
16 * };
17 */
18
19export async function myUpdateFulfillmentFunction(identifiers, options) {
20 try {
21 const updatedOrderFulfillments = await orderFulfillments.updateFulfillment(identifiers, options);
22
23 const fulfillmentsArray = updatedOrderFulfillments.orderWithFulfillments.fulfillments;
24 console.log('Success! Updated fulfillment', updatedOrderFulfillments);
25
26 return updatedOrderFulfillments;
27 } catch (error) {
28 console.error(error);
29 // Handle the error
30 }
31
32}
33
34/* Promise resolves to:
35 *
36 * {
37 * "orderWithFulfillments": {
38 * "orderId": "a6c3a817-579d-4cb5-8521-2fe53b2c4bf1",
39 * "fulfillments": [
40 * {
41 * "_id": "a838877d-3f13-49f3-ab29-1cde478e0949",
42 * "_createdDate": "2023-03-07T14:30:21.535Z",
43 * "lineItems": [
44 * {
45 * "_id": "00000000-0000-0000-0000-000000000001",
46 * "quantity": 1
47 * }
48 * ],
49 * "trackingInfo": {
50 * "trackingNumber": "45677",
51 * "shippingProvider": "usps",
52 * "trackingLink": "https://tools.usps.com/go/TrackConfirmAction.action?tLabels=45677"
53 * }
54 * }
55 * ]
56 * }
57 * }
58 *
59 */