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

Facet normalizer

Concept of facets exists in both Unified Data Layer world and SFCC. The normalizeFacet function maps SFCC Refinement into Unified SfFacet.

Parameters

NameTypeDefault valueDescription
refinementRefinementSFCC Refinement
ctxNormalizeFacetContext

Extending

The SfFacet is returned from SearchProducts Method. If the SfFacet 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 SfFacet with a description field.

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

const normalizers = defineNormalizers<typeof normalizersSFCC>()({
  ...normalizersSFCC,
  normalizeFacet: (refinement) => ({
    ...normalizersSFCC.normalizeFacet(refinement),
    description: refinement.description,
  }),
});

Source

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