diff --git a/modules/price/src/Plugin/Field/FieldFormatter/PriceDefaultFormatter.php b/modules/price/src/Plugin/Field/FieldFormatter/PriceDefaultFormatter.php index 5b17b4e7..c319ae7a 100644 --- a/modules/price/src/Plugin/Field/FieldFormatter/PriceDefaultFormatter.php +++ b/modules/price/src/Plugin/Field/FieldFormatter/PriceDefaultFormatter.php @@ -156,6 +156,10 @@ public function viewElements(FieldItemListInterface $items, $langcode) { $elements = []; foreach ($items as $delta => $item) { $currency = $currencies[$item->currency_code]; + // Set Fraction digits to the precision required by the current currency, + // to format the price in the expected way. + $this->numberFormatter->setMinimumFractionDigits($currency->getFractionDigits()); + $this->numberFormatter->setMaximumFractionDigits($currency->getFractionDigits()); $elements[$delta] = [ '#markup' => $this->numberFormatter->formatCurrency($item->number, $currency), '#cache' => [