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.
function updateFulfillment(
identifiers: UpdateFulfillmentIdentifiers,
options: UpdateFulfillmentOptions,
): Promise<OrderWithFulfillments>;
Order and fulfillment IDs to be updated.
Available options to use when updating a fulfillment.
Updates the fulfillment's trackingNumber
import { orderFulfillments } from "@wix/ecom";
/* 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.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"
* }
* }
* ]
* }
* }
*
*/
There is 1 error with this status code.
This method may also return standard errors. Learn more about standard Wix errors.