You are reading the documentation for v7.x and earlier, which is no longer the latest version. Switch to v8.x
getProductReviews
Get reviews of a single product from SAP Commerce Cloud.
This method receives data from the getProductReviews endpoint exposed by the SAP OCC API Products Controller.
Signature
export declare function getProductReviews(
context: SapccIntegrationContext,
props: GetProductReviewsProps
): Promise<ReviewList>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
context | Required | SapccIntegrationContext | |
props | Required | GetProductReviewsProps | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
Referenced Types
Examples
Fetching a product by its productCode.
import { sdk } from '~/sdk';
const product = await sdk.commerce.getProductReviews({ productCode: '1992695' });Using the method the way it will be possible to cache the response.
import { sdk } from '~/sdk';
const product = await sdk.commerce.getProductReviews({ productCode: '1992695', lang: 'en', currency: 'GBP' });Fetching a product by its productCode and selecting response fields.
import { sdk } from '~/sdk';
const product = await sdk.commerce.getProductReviews({ productCode: '1992695', fields: 'BASIC' });Fetching a product by its productCode and setting the maxCount of reviews.
import { sdk } from '~/sdk';
const product = await sdk.commerce.getProductReviews({ productCode: '1992695', maxCount: 4 });