getOrderDetails(orderId: number): Promise<UserOrderDetails | null>¶
The getOrderDetails method allows you to get detailed information about a specific order of a currently authenticated user.
Parameters¶
orderId: number¶
The ID of the order to retrieve details for.
Returned value¶
A returned value has a type of Promise<UserOrderDetails | null> where UserOrderDetails represents the UserOrderDetails model.
Example¶
In this example we make a UserApi call to get detailed information about a specific order.
useStorefront(async (storefront) => {
const userApi = await storefront.getApi('UserApi');
const orderDetail = await userApi.getOrderDetails(12345);
if(orderDetail) {
const orderedProducts = orderDetail.products;
console.log('ordered products list:', orderedProducts)
}
});
User API methods reference¶
- getUser
- selectUser$
- getOrders
- selectOrders$
- selectOrderDetails$
- getAddresses
- selectAddresses$
- isProductNotificationPossible
- selectIsProductNotificationPossible$
- getLoyaltyPoints
- selectLoyaltyPoints$
- getCurrentCountry
Related Methods¶
- getOrders - Get list of all user orders (summary view)
- selectOrderDetails$ - Get order details as reactive Observable