Alokai
You are reading the documentation for v7.x and earlier, which is no longer the latest version. Switch to v8.x

createCartFromOrder

Create cart based on the products ordered in a past order. This method requires deleting the current cart, so that a new cart based on the given order can be put in its place.

This method exchanges data with the createCartFromOrder endpoint exposed by the SAP OCC API .

Signature

export declare function createCartFromOrder(
	context: SapccIntegrationContext,
	props: CreateCartFromOrderProps
): Promise<CartModificationList>;

Parameters

NameRequiredTypeDescription
contextRequiredSapccIntegrationContext
propsRequiredCreateCartFromOrderPropsParameter object which can be used with this method. Refer to its type definition to learn about possible properties.

Returns

Returns the operations applied to the new cart in order to make it the same as from the one in input

Referenced Types

Examples

Creating a new cart, which will contain products bought as part of a previous order

import { sdk } from '~/sdk';

const props = { orderCode: "00001234" };
await sdk.commerce.deleteCart({ cartId: "current"});
const cartModificationsList = await sdk.commerce.createCartFromOrder(props);

On this page