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.
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
Order and fulfillment IDs to be updated.
Available options to use when updating a fulfillment.
Returns
Order ID and the orders' associated fulfillments after update.
Return Type:
NAME
TYPE
DESCRIPTION
Fulfillments associated with the order.
Order ID.
Was this helpful?
Updates the fulfillment's trackingNumber
1import { orderFulfillments } from 'wix-ecom-backend';23/* 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 */1819export async function myUpdateFulfillmentFunction(identifiers, options) {20 try {21 const updatedOrderFulfillments = await orderFulfillments.updateFulfillment(identifiers, options);2223 const fulfillmentsArray = updatedOrderFulfillments.orderWithFulfillments.fulfillments;24 console.log('Success! Updated fulfillment', updatedOrderFulfillments);2526 return updatedOrderFulfillments;27 } catch (error) {28 console.error(error);29 // Handle the error30 }3132}3334/* 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": 147 * }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 */
Updates the fulfillment's trackingNumber
1import { Permissions, webMethod } from 'wix-web-module';2import { orderFulfillments } from 'wix-ecom-backend';34/* Sample identifiers value:5 * {6 * orderId: 'a6c3a817-579d-4cb5-8521-2fe53b2c4bf1',7 * fulfillmentId: 'a838877d-3f13-49f3-ab29-1cde478e0949'8 * };9 *10 * Sample options value:11 * {12 * fulfillment: {13 * trackingInfo: {14 * trackingNumber: '45677'15 * }16 * }17 * };18 */1920export const myUpdateFulfillmentFunction = webMethod(Permissions.Anyone, async (identifiers, options) => {21 try {22 const updatedOrderFulfillments = await orderFulfillments.updateFulfillment(identifiers, options);2324 const fulfillmentsArray = updatedOrderFulfillments.orderWithFulfillments.fulfillments;25 console.log('Success! Updated fulfillment', updatedOrderFulfillments);2627 return updatedOrderFulfillments;28 } catch (error) {29 console.error(error);30 // Handle the error31 }32});3334/* 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": 147 * }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 */60