Search.../

updateFulfillment( )

Updates an existing fulfillment in an order.

Description

The updateFulfillment() function returns a Promise that is resolved to an updated Order object when the specified fulfillment in the order is updated.

Currently, you can only update a fulfillment's tracking information.

Syntax

function updateFulfillment(orderId: string, fulfillmentId: string, trackingInfo: TrackingInfo): Promise<Order>

updateFulfillment Parameters

NAME
TYPE
DESCRIPTION
orderId
string

ID of the order to update the fulfillment in.

fulfillmentId
string

ID of the fulfillment to update.

trackingInfo
TrackingInfo

Tracking information to update in the fulfillment.

Returns

Fulfilled - The order with the updated fulfillment.

Return Type:

Promise<Order>
NAME
TYPE
DESCRIPTION
_id
string

Unique order ID.

_updatedDate
string

Date and time the order was updated.

buyerLanguage
string

The site's displayed language.

cartId
Optional
string

Shopping cart ID.

channelInfo
ChannelInfo

Channel information.

enteredBy
EnteredBy

Identity of the order's initiator.

billingInfo
Optional
BillingInfo

Billing information.

buyerInfo
BuyerInfo

Buyer information.

buyerNote
Optional
string

A note added by the buyer.

_dateCreated
string

Date and time the order was created.

currency
string

Order currency.

fulfillmentStatus
string

The order's current fulfillment status (whether the order received a tracking number or was delivered/picked up). One of:

  • "NOT_FULFILLED": Order is not yet fulfilled.
  • "FULFILLED": Order was fulfilled successfully.
  • "CANCELLED": Order was cancelled.
  • "PARTIALLY_FULFILLED": Order was partially fulfilled. For example, when only some of the order's items were fulfilled.
archived
boolean

Whether or not the order was archived.

activities
Array<Activities>

Log of updates related to the order.

number
number

Running order number.

paymentStatus
string

Current status of the payment. One of:

  • "NOT_PAID": Payment was not made.
  • "PAID": Order was successfully paid for.
  • "PARTIALLY_REFUNDED": Order was partially refunded.
  • "FULLY_REFUNDED": Order was refunded in full.
shippingInfo
Optional
OrderShippingInfo

Shipping information.

lineItems
Array<OrderLineItem>

Order items.

totals
Totals

Order totals.

weightUnit
Optional
string

The unit in which the order's weight is measured. Either "KG" or "LB". If not provided, the site's default weight unit is used.

customField
Optional
CustomField

Custom field information.

fulfillments
Array<Fulfillment>

Order fulfillment information.

discount
Optional
Discount

Discount information.

refunds
Optional
Array<Refund>

Refund information.

Was this helpful?

Update a fulfillment

Copy Code
1import wixStoresBackend from 'wix-stores-backend';
2
3const trackingInfo = {
4 "shippingProvider": "fedex",
5 "trackingLink": "https://www.fedex.com/apps/fedextrack/?action=track&trackingnumber=6789",
6 "trackingNumber": "6789",
7}
8
9export function updateFulfillment(orderId, fulfillmentId) {
10 return wixStoresBackend.updateFulfillment(
11 orderId,
12 fulfillmentId,
13 trackingInfo
14 )
15 .then((updatedOrder) => {
16 // Fulfillment updated
17 const orderFulfillmentStatus = updatedOrder.fulfillmentStatus
18 })
19 .catch(error => {
20 // Fulfillment not updated
21 console.error(error)
22 })
23}
24
25/* Returns promise that resolves to:
26 *
27 * {
28 * "order": {
29 * "_id": "d5d43d01-d9a4-4cc2-b257-61184b881447",
30 * "_updatedDate": "2020-06-12T10:24:22.938Z",
31 * "buyerLanguage": "en",
32 * "channelInfo": {
33 * "type": "WEB"
34 * },
35 * "enteredBy": {
36 * "id": "f6c2c0f9-4e9f-a58d-a02d-9af2497294d9",
37 * "identityType": "MEMBER"
38 * },
39 * "billingInfo": {
40 * "address": {
41 * "formatted": "My company name\n235 W 23rd St\nNew York, New York 10011\nUnited States\n+15555555555",
42 * "city": "New York",
43 * "country": "USA",
44 * "addressLine": "235 W 23rd St",
45 * "postalCode": "10011",
46 * "subdivision": "NY"
47 * },
48 * "firstName": "John",
49 * "lastName": "Doe",
50 * "email": "john.doe@somedomain.com",
51 * "phone": "+15555555555",
52 * "company": "My company name",
53 * "externalTransactionId": "7c03ca74-eaf5-4541-8678-9b857634fdcb",
54 * "paidDate": "2020-05-27T12:20:37.994Z",
55 * "paymentMethod": "VISA",
56 * "paymentGatewayTransactionId": "29A06193U6234935D",
57 * "paymentProviderTransactionId": "7c03ca74-eaf5-4541-8678-9b857634fdcb"
58 * },
59 * "buyerInfo": {
60 * "id": "f6c2c0f9-4e9f-a58d-a02d-9af2497294d9",
61 * "identityType": "MEMBER",
62 * "firstName": "John",
63 * "lastName": "Doe",
64 * "phone": "+15555555555",
65 * "email": "john.doe@somedomain.com"
66 * },
67 * "_dateCreated": "2020-05-27T12:20:37.966Z",
68 * "currency": "ILS",
69 * "fulfillmentStatus": "FULFILLED",
70 * "archived": false,
71 * "activities": [
72 * {
73 * "type": "ORDER_PLACED",
74 * "timestamp": "2020-05-27T12:20:37.966Z"
75 * },
76 * {
77 * "type": "ORDER_PAID",
78 * "timestamp": "2020-05-27T12:20:37.994Z"
79 * }
80 * ],
81 * "number": 10019,
82 * "paymentStatus": "PAID",
83 * "shippingInfo": {
84 * "deliveryOption": "Free Shipping",
85 * "estimatedDeliveryTime": "4:30pm",
86 * "shippingRegion": "Domestic",
87 * "shipmentDetails": {
88 * "address": {
89 * "formatted": "company name\n235 W 23rd St\nNew York, New York 10011\nUnited States\n5555555555",
90 * "city": "New York",
91 * "country": "USA",
92 * "addressLine": "235 W 23rd St",
93 * "postalCode": "10011",
94 * "subdivision": "NY"
95 * },
96 * "firstName": "John",
97 * "lastName": "Doe",
98 * "email": "john.doe@somedomain.com",
99 * "phone": "5555555555",
100 * "company": "company name",
101 * "tax": 0,
102 * "discount": 0,
103 * "priceData": null
104 * },
105 * "pickupDetails": null
106 * },
107 * "lineItems": [
108 * {
109 * "index": 1,
110 * "quantity": 1,
111 * "price": 5,
112 * "name": "my product's name",
113 * "translatedName": "Nombre traducido",
114 * "productId": "3fb6a3c8-988b-8755-04bd-5c59ae0b18ea",
115 * "totalPrice": 5,
116 * "lineItemType": "PHYSICAL",
117 * "options": [
118 * {
119 * "option": "Size",
120 * "selection": "Medium"
121 * }
122 * ],
123 * "customTextFields": [
124 * {
125 * "title": "Notes for delivery",
126 * "value": "Please leave at front door"
127 * }
128 * ],
129 * "weight": 1.42,
130 * "sku": "36523641234523",
131 * "discount": 0,
132 * "tax": 5,
133 * "taxIncludedInPrice": true,
134 * "priceData": {
135 * "price": "5",
136 * "totalPrice": 5,
137 * "taxIncludedInPrice": true
138 * },
139 * "mediaItem": null
140 * }
141 * ],
142 * "totals": {
143 * "discount": 0,
144 * "quantity": 1,
145 * "shipping": 0,
146 * "subtotal": 5,
147 * "tax": 0,
148 * "total": 5,
149 * "weight": 1.42
150 * },
151 * "weightUnit": "KG",
152 * "customField": {
153 * "value": "Please call when outside",
154 * "title": "Notes for delivery",
155 * "translatedTitle": "Notas de entrega"
156 * },
157 * "fulfillments": [
158 * {
159 * "id": "cfbc5122-8766-4209-8bf4-611a10f9c546",
160 * "dateCreated": "2020-06-10T15:38:10.938Z",
161 * "lineItems": [
162 * {
163 * "index": 1,
164 * "quantity": 1
165 * }
166 * ],
167 * "trackingInfo": {
168 * "trackingNumber": "6789",
169 * "shippingProvider": "fedex",
170 * "trackingLink": "https://www.fedex.com/apps/fedextrack/?action=track&trackingnumber=6789"
171 * },
172 * }
173 * ],
174 * "discount": null
175 * }
176 * }
177 *
178 */