The Vue Storefront Essentials Course is now available! Learn More
Category normalizer

Category normalizer

The normalizeCategory function is used to map a SAP CategoryHierarchy or Category into the unified SfCategory data model.


NameTypeDefault valueDescription
categoryCategoryHierarchy or CategorySAP Category


The SfCategory model is returned from the Unified Methods such as SearchProducts, and GetCategories. If the SfCategory structure doesn't contain the information you need for your Storefront, you can extend its logic using the defineNormalizers function. The following example demonstrates how to extend SfCategory with an url field.

import { normalizers as normalizersSAP, defineNormalizers } from "@vsf-enterprise/unified-api-sapcc";

const normalizers = defineNormalizers<typeof normalizersSAP>()({
  normalizeCategory: (category) => ({
    url: category.url,


CategoryHiearchy is returned from API Client's the getCatalogVersion and Category from the getProduct.

import { User } from "@vsf-enterprise/sapcc-types";
import { SfCustomer } from "@vue-storefront/unified-data-model";

export function normalizeCustomer(user: User): SfCustomer {
  if (!user.customerId || !user.uid || !user.firstName || !user.lastName) {
    throw new Error("Missing required fields for customer");

  return {
    id: user.customerId,
    firstName: user.firstName,
    lastName: user.lastName,
    email: user.uid,