Skip to content

Commit 158380b

Browse files
committed
ACP2E-1012: No space between a custom currency symbol and a price
1 parent cd826aa commit 158380b

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

app/code/Magento/CurrencySymbol/Model/System/Currencysymbol.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,8 @@ public function getCurrencySymbol($code)
243243
{
244244
$customSymbols = $this->_unserializeStoreConfig(self::XML_PATH_CUSTOM_CURRENCY_SYMBOL);
245245
if (array_key_exists($code, $customSymbols)) {
246-
return $customSymbols[$code];
246+
// remove non-breaking space from custom currency symbol and allow custom NBSP in currency symbol
247+
return preg_replace('/( |&nbsp|\xc2\xa0)*/iu', '', $customSymbols[$code]);
247248
}
248249

249250
return false;

app/code/Magento/Directory/Model/Currency.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -432,11 +432,6 @@ private function formatCurrency(string $price, array $options): string
432432
$this->getCode() ?? $this->numberFormatter->getTextAttribute(\NumberFormatter::CURRENCY_CODE)
433433
);
434434

435-
if (array_key_exists(LocaleCurrency::CURRENCY_OPTION_SYMBOL, $options)) {
436-
// remove only one non-breaking space from custom currency symbol to allow custom NBSP in currency symbol
437-
$formattedCurrency = preg_replace('/ /u', '', $formattedCurrency, 1);
438-
}
439-
440435
if ((array_key_exists(LocaleCurrency::CURRENCY_OPTION_DISPLAY, $options)
441436
&& $options[LocaleCurrency::CURRENCY_OPTION_DISPLAY] === \Magento\Framework\Currency::NO_SYMBOL)) {
442437
$formattedCurrency = str_replace(' ', '', $formattedCurrency);

0 commit comments

Comments
 (0)