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

getProductsByIds

Fetches products by their IDs from the SAP Commerce Cloud.

This method receives data from the getProductsByIds endpoint exposed by the SAP OCC API though Alokai-OCC extension Alokai Products Controller.

Signature

export declare function getProductsByIds(
	context: SapccIntegrationContext,
	props: ProductsByIdsProps
): Promise<SimpleProductList>;

Parameters

NameRequiredTypeDescription
contextRequiredSapccIntegrationContext
propsRequiredProductsByIdsProps

Returns

Returns a representation of a list of Products.

Referenced Types

Examples

Fetching products by their IDs (passed as the ids array).

import { sdk } from '~/sdk';

const products = await sdk.commerce.getProductsByIds({ ids: ['1992695', '4392695'] });

Fetching a a list of Products and selecting response fields.

import { sdk } from '~/sdk';

const products = await sdk.commerce.getProductsByIds({ ids: ['1992695', '4392695'], fields: 'BASIC' });

On this page