Search.../

listFulfillmentsForMultipleOrders( )

Retrieves fulfillments associated with multiple specified orders.

Description

The listFulfillmentsForMultipleOrders() function returns a Promise that resolves when the fulfillments are retrieved.

Syntax

function listFulfillmentsForMultipleOrders(orderIds: Array<string>): Promise<ListFulfillmentsForMultipleOrdersResponse>

listFulfillmentsForMultipleOrders Parameters

NAME
TYPE
DESCRIPTION
orderIds
Array<
string
>

List of order IDs for which to retrieve fulfillments.

Returns

Return Type:

Promise<
ListFulfillmentsForMultipleOrdersResponse
>
NAME
TYPE
DESCRIPTION
ordersWithFulfillments
Array<
OrderWithFulfillments
>

List of order IDs and their associated fulfillments.

Was this helpful?

Retrieve fulfillments for 2 orders

Copy Code
1import { orderFulfillments } from 'wix-ecom-backend';
2
3/* Sample orderIds value:
4 * [
5 * 'ed4595fc-4e3d-4ba6-8583-e9e92b97ec8a', '7001d34b-11a6-4a34-8746-dc8ababeca42'
6 * ];
7 */
8
9export async function myListFulfillmentsForMultipleOrdersFunction(orderIds) {
10 try {
11 const retrievedOrdersFulfillments = await orderFulfillments.listFulfillmentsForMultipleOrders(orderIds);
12
13 const firstOrderFulfillments = retrievedOrdersFulfillments[0].fulfillments;
14 const secondOrderFulfillments = retrievedOrdersFulfillments[1].fulfillments;
15 console.log("Success! Retrieved orders' fulfillments:", retrievedOrdersFulfillments);
16
17 return retrievedOrdersFulfillments;
18 } catch (error) {
19 console.error(error);
20 // Handle the error
21 }
22
23}
24
25
26/* Promise resolves to:
27 *
28 * {
29 * "ordersWithFulfillments": [
30 * {
31 * "orderId": "ed4595fc-4e3d-4ba6-8583-e9e92b97ec8a",
32 * "fulfillments": [
33 * {
34 * "_id": "3247615d-dbbe-4cc8-a410-6ca809f1283f",
35 * "_createdDate": "2023-02-27T12:02:57.364Z",
36 * "lineItems": [
37 * {
38 * "_id": "00000000-0000-0000-0000-000000000001",
39 * "quantity": 1
40 * }
41 * ],
42 * "trackingInfo": {
43 * "trackingNumber": "87236",
44 * "shippingProvider": "fedex",
45 * "trackingLink": "https://www.fedex.com/apps/fedextrack/?action=track&trackingnumber=87236"
46 * }
47 * }
48 * ]
49 * },
50 * {
51 * "orderId": "7001d34b-11a6-4a34-8746-dc8ababeca42",
52 * "fulfillments": [
53 * {
54 * "_id": "00a7eba6-059e-430c-9f8e-9d3d31dd5e9d",
55 * "_createdDate": "2023-03-07T11:51:48.233Z",
56 * "lineItems": [
57 * {
58 * "_id": "00000000-0000-0000-0000-000000000003",
59 * "quantity": 1
60 * }
61 * ],
62 * "trackingInfo": {
63 * "trackingNumber": "28674",
64 * "shippingProvider": "dhl",
65 * "trackingLink": "https://www.logistics.dhl/global-en/home/tracking.html?tracking-id=28674"
66 * }
67 * },
68 * {
69 * "_id": "47451ae1-7325-4ef6-a0d8-fb91ffa88e2e",
70 * "_createdDate": "2023-03-07T10:24:56.406Z",
71 * "lineItems": [
72 * {
73 * "_id": "00000000-0000-0000-0000-000000000001",
74 * "quantity": 1
75 * },
76 * {
77 * "_id": "00000000-0000-0000-0000-000000000002",
78 * "quantity": 1
79 * }
80 * ],
81 * "trackingInfo": {
82 * "trackingNumber": "43255",
83 * "shippingProvider": "fedex",
84 * "trackingLink": "https://www.fedex.com/apps/fedextrack/?action=track&trackingnumber=43255"
85 * }
86 * }
87 * ]
88 * }
89 * ]
90 * }
91 *
92 */