trackOrder
Method for tracking an order by number and additional criteria.
This method communicates with the trackOrder endpoint of the Vue Storefront API Middleware. In turn, it receives data from the Get order endpoint exposed by OCAPI. It avoids using the getOrdersByID endpoint due to its requirement of needing to maintain a BM user with an expiring access token.
The criteria object fully matches an Order object by its structure, but everything is optional. Any fields passed in it will be deeply compared with the order as retrieved by number, and if there is a mismatch, the order will not be returned. This way additional confirmation factors can be requested by the customer before displaying the order (which can contain PII). For reference: SiteGenesis/SFRA require the order's customer email and billing postal code
Signature
export declare function trackOrder(
props: OrderTrackParams
): Promise<import("commerce-sdk/dist/checkout/checkout").ShopperOrders.Order>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | OrderTrackParams | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
Returns
Returns a representation of an Order.
Referenced Types
OrderTrackParamsShopperOrders.Order
Examples
Tracking an order by orderNo, and requiring the customer email and billing postal code that the order was placed with to be provided.
import { sdk } from '~/sdk.config.ts';
const category = await sdk.commerce.trackOrder('0000001', {
customer: {
email: 'email@address.com',
},
billingAddress: {
postalCode: '12345',
},
});