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.

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.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Stores - all permissions
Manage Restaurants - all permissions
Manage eCommerce - all permissions
Manage Orders
Learn more about app permissions.
Method Declaration
Copy
function updateFulfillment(
  identifiers: UpdateFulfillmentIdentifiers,
  options: UpdateFulfillmentOptions,
): Promise<OrderWithFulfillments>;
Method Parameters
identifiersUpdateFulfillmentIdentifiersRequired

Order and fulfillment IDs to be updated.


optionsUpdateFulfillmentOptions

Available options to use when updating a fulfillment.

Returns
Return Type:Promise<OrderWithFulfillments>

Updates the fulfillment's trackingNumber

JavaScript
import { orderFulfillments } from "wix-ecom-backend"; /* Sample identifiers value: * { * orderId: 'a6c3a817-579d-4cb5-8521-2fe53b2c4bf1', * fulfillmentId: 'a838877d-3f13-49f3-ab29-1cde478e0949' * }; * * Sample options value: * { * fulfillment: { * trackingInfo: { * trackingNumber: '45677' * } * } * }; */ export async function myUpdateFulfillmentFunction(identifiers, options) { try { const updatedOrderFulfillments = await orderFulfillments.updateFulfillment( identifiers, options, ); const fulfillmentsArray = updatedOrderFulfillments.orderWithFulfillments.fulfillments; console.log("Success! Updated fulfillment", updatedOrderFulfillments); return updatedOrderFulfillments; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * * { * "orderWithFulfillments": { * "orderId": "a6c3a817-579d-4cb5-8521-2fe53b2c4bf1", * "fulfillments": [ * { * "_id": "a838877d-3f13-49f3-ab29-1cde478e0949", * "_createdDate": "2023-03-07T14:30:21.535Z", * "lineItems": [ * { * "_id": "00000000-0000-0000-0000-000000000001", * "quantity": 1 * } * ], * "trackingInfo": { * "trackingNumber": "45677", * "shippingProvider": "usps", * "trackingLink": "https://tools.usps.com/go/TrackConfirmAction.action?tLabels=45677" * } * } * ] * } * } * */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?