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

replaceOrgCartCostCenter

Updates the cost center for the B2B cart in SAP Commerce Cloud.

This method sends a POST request to the replaceOrgCartCostCenter endpoint of the Alokai Middleware. In turn, it exchanges data with the replaceOrgCartCostCenter 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. In case there is no cookie, it won't work.

Signature

export declare function replaceOrgCartCostCenter<Res extends Cart = Cart,
	Props extends ReplaceOrgCartCostCenterProps = ReplaceOrgCartCostCenterProps>(
	props: Props,
	options?: MethodOptions
): Promise<Res>;

Parameters

NameRequiredTypeDescription
propsRequiredPropsParameter object which can be used with this method. Refer to its type definition to learn about possible properties.
optionsOptionalMethodOptionsOptions that can be passed to additionally configure the request or customize the logic in a plugin.

Returns

Returns a representation of a Cart.

Referenced Types

Examples

Updates the cost center for the B2B cart (make sure you are an authenticated customer). HINT: Before, make sure you set added some entity to the cart and set the payment type to the ACCOUNT.

import { sdk } from '~/sdk';

const cart = await sdk.commerce.replaceOrgCartCostCenter({ cartId: '00035084', costCenterId: 'Pronto_Services' });

Updates the cost center for the B2B cart and selecting response fields.

import { sdk } from '~/sdk';

const cart = await sdk.commerce.replaceOrgCartCostCenter({ cartId: '00035084', costCenterId: 'Pronto_Services', fields: 'code,guid,costCenter(FULL)' });

On this page