Deletes an existing order fulfillment.
The deleteFulfillment()
function returns a Promise that resolves when the fulfillment is deleted.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function deleteFulfillment(
identifiers: DeleteFulfillmentIdentifiers,
): Promise<DeleteFulfillmentResponse>;
Order and fulfillment IDs.
import { orderFulfillments } from "wix-ecom-backend";
/* Sample identifiers value:
* {
* orderId: 'e613320a-8e8f-4f8f-9d87-b5edc9f99788',
* fulfillmentId: '91357295-a95c-4973-b210-281640f3e795'
* };
*/
export async function myDeleteFulfillmentFunction(identifiers) {
try {
const { orderWithFulfillments } =
await orderFulfillments.deleteFulfillment(identifiers);
const fulfillmentsArray = orderWithFulfillments.fulfillments;
console.log("Success! Deleted fulfillment", orderWithFulfillments);
return orderWithFulfillments;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
*
* {
* "orderWithFulfillments": {
* "orderId": "e613320a-8e8f-4f8f-9d87-b5edc9f99788",
* "fulfillments": []
* }
* }
*
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.