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

Category normalizer

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

Parameters

NameTypeDefault valueDescription
categoryCategory.SFCC Category

Extending

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 thumbnail field.

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

const normalizers = defineNormalizers<typeof normalizersSFCC>()({
  ...normalizersSFCC,
  normalizeCategory: (category) => ({
    ...normalizersSFCC.normalizeCategory(category),
    thumbnail: category.thumbnail,
  }),
});

Source

🔴 ../../node_modules/@vsf-enterprise/unified-api-sfcc/src/normalizers/category/category.ts | Snippet does not exist 🔴