Vue Storefront is now Alokai! Learn More
Product review normalizer

Product review normalizer

The normalizeProductReview function maps SAP Review into Unified SfProductReview.


NameTypeDefault valueDescription
contextNormalizerContextcontext needed for the normalizer.
reviewReviewSAP Review


The SfProductReview is returned from GetProductReviews Method. If the SfProductReview structure doesn't contain the information you need for your Storefront, you can extend its logic using the addCustomFields API. The following example demonstrates how to extend SfProductReview with a alias field.

export const unifiedApiExtension = createUnifiedExtension({
  normalizers: {
    addCustomFields: [
        normalizeProductReview: (context, review) => ({
          alias: review.alias,
  config: {


import { maybe } from "@shared/utils";
import { defineNormalizer } from "../defineNormalizer";

export const normalizeProductReview = defineNormalizer.normalizeProductReview((context, review) => {
  return {
    id:! as string,
    title: maybe(,
    text: maybe(review.comment),
    rating: maybe(review.rating),
    reviewer: maybe(review.principal?.name),
    createdAt: new Date(!).toISOString(),