You are reading the documentation for v7.x and earlier, which is no longer the latest version. Switch to v8.x
getUserOrder
Method fetching an order from SAP Commerce Cloud.
This method sends a POST request to the getUserOrders endpoint of the Alokai Middleware. In turn, it exchanges data with the getUserOrders endpoint exposed by the SAP OCC API Orders Controller.
For logged-in users, make sure to pass order code as the code param. In case of anonymous users, pass order guid instead.
You might also want to see the getUserOrderHistory method.
Signature
export declare function getUserOrder<Res extends Order = Order,
Props extends GetUserOrdersProps = GetUserOrdersProps>(
props: Props,
options?: MethodOptions
): Promise<Res>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | Props | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
options | Optional | MethodOptions | Options that can be passed to additionally configure the request or customize the logic in a plugin. |
Returns
Returns a representation of an Order.
Referenced Types
Examples
Fetching an order.
import { sdk } from '~/sdk';
const order = await sdk.commerce.getUserOrder({ code: '00035084' });Fetching an order and selecting response fields.
import { sdk } from '~/sdk';
const order = await sdk.commerce.getUserOrder({ code: '00035084', fields: 'code,guid,deliveryStatus' });