You are reading the documentation for v7.x and earlier, which is no longer the latest version. Switch to v8.x
getCurrentOrgCart
Fetches a B2B cart of the current user.
This method exchanges data with the getCurrentOrgCart endpoint exposed by the SAP OCC API B2B Carts Controller.
This method is only for an authenticated customer as it uses vsf-sap-token cookie, to fetch a current B2B cart of the current user. In case there is no cookie, it won't work.
Signature
export declare function getCurrentOrgCart(
context: SapccIntegrationContext,
props?: BaseProps & BaseUserId
): Promise<Cart>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
context | Required | SapccIntegrationContext | |
props | Optional | BaseProps & BaseUserId | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
Returns
Returns a representation of a Cart.
Referenced Types
Examples
Fetching a current B2B cart (make sure you are an authenticated customer).
import { sdk } from '~/sdk';
const cart = await sdk.commerce.getCurrentOrgCart();Fetching a current B2B cart and selecting response fields.
import { sdk } from '~/sdk';
const cart = await sdk.commerce.getCurrentOrgCart({ fields: 'code,guid,user(FULL)' });