getCartDeliveryModes
Method getting available delivery modes for the cart in SAP Commerce Cloud.
This method sends a POST request to the getCartDeliveryModes endpoint of the Alokai Middleware. In turn, it exchanges data with the getCartDeliveryModes endpoint exposed by the SAP OCC API Cart Delivery Modes Controller.
This method will only work for either a current user cart or a guest cart (i.e. cart with an email added to it). It will not work with an anonymous cart. The cart has to be assigned a delivery address beforehand. In case of a guest cart, remember to pass cart guid as the cartId param. In case of a current user cart, pass cart code instead.
Signature
export declare function getCartDeliveryModes<Res extends DeliveryModeList = DeliveryModeList,
Props extends GetCartDeliveryModesProps = GetCartDeliveryModesProps>(
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 a Delivery Mode List.
Referenced Types
Examples
Fetching delivery modes for the cart.
import { sdk } from '~/sdk';
const { deliveryModes } = await sdk.commerce.getCartDeliveryModes({ cartId: '00035084' });Fetching delivery modes for the cart and selecting response fields.
import { sdk } from '~/sdk';
const { deliveryModes } = await sdk.commerce.getCartDeliveryModes({
cartId: '00035084',
fields: 'deliveryModes(code)'
});