Vue Storefront is now Alokai! Learn More
Money normalizer

Money normalizer

The normalizeMoney function maps SAP Price into Unified SfMoney.


NameTypeDefault valueDescription
contextNormalizerContextcontext needed for the normalizer.
pricePriceSAP price


The SfMoney is returned as a part of multiple models, as for example SfProduct, SfProductCatalogItem, and SfCart.

If you want to change the global attributes representation, you should override all root normalizers, so for example normalizeCart, normalizeProduct etc. Overriding the normalizeMoney function will not change have an impact of the image normalization inside these functions, it is just an utils function which may be then used in writing other custom normalizers or methods.


import { defineNormalizer } from "../defineNormalizer";

export const normalizeMoney = defineNormalizer.normalizeMoney((context, money) => {
  const amount = money.value as number;

  return {
    currency: money.currencyIso as string,
    precisionAmount: amount.toFixed(2),