Search.../

onFulfillmentsUpdated( )

An event that triggers when one or more of an order's fulfillments are created, updated, or deleted.

Description

The onFulfillmentsUpdated() event handler runs when a fulfillment is updated. The received object contains information about the fulfillment that was updated and event metadata.

Note: Backend events don't work when previewing your site.

Syntax

function wixEcom_onFulfillmentsUpdated(event: FulfillmentsUpdated): void

onFulfillmentsUpdated Parameters

NAME
TYPE
DESCRIPTION
event
Optional
FulfillmentsUpdated

Information about the fulfillments that were updated.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

An event fired when an order fulfillment is updated

Copy Code
1// Place this code in the events.js file
2// of your site's Backend section.
3// Add the file if it doesn't exist.
4
5export function wixEcom_onFulfillmentsUpdated(event) {
6 const orderId = event.entity.orderId;
7 const fulfillmentId = event.entity.fulfillments[0]._id;
8 const eventId = event.metadata.id;
9 console.log('Fulfillment updated', event)
10}
11
12/* Full event object:
13 *
14 * {
15 * "metadata": {
16 * "id": "aa6bf186-a19f-4085-8726-11fde6b629f7",
17 * "entityId": "a6c3a817-579d-4cb5-8521-2fe53b2c4bf1",
18 * "eventTime": "2023-03-08T11:04:15.512044Z",
19 * "triggeredByAnonymizeRequest": false
20 * },
21 * "entity": {
22 * "orderId": "a6c3a817-579d-4cb5-8521-2fe53b2c4bf1",
23 * "fulfillments": [
24 * {
25 * "_id": "a838877d-3f13-49f3-ab29-1cde478e0949",
26 * "_createdDate": "2023-03-07T14:30:21.535Z",
27 * "lineItems": [
28 * {
29 * "_id": "00000000-0000-0000-0000-000000000001",
30 * "quantity": 1
31 * }
32 * ],
33 * "trackingInfo": {
34 * "trackingNumber": "12345",
35 * "shippingProvider": "usps",
36 * "trackingLink": "https://tools.usps.com/go/TrackConfirmAction.action?tLabels=12345"
37 * }
38 * }
39 * ]
40 * }
41 * }
42 *
43 */