cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.4.2-p1 => 2.4.3 creditmemo error: values with currency symbol

Magento 2.4.2-p1 => 2.4.3 creditmemo error: values with currency symbol

Hello,

 

after Update to Magento 2.4.3 we cannot create a creditmemo anymore.

The Values in the totals input fields now formatted with currency value, which is not valid.

Has soneone an idea how to fix this? We have the shop currency in Euro (allowed Euro and Dollar), tried both, orders in $ and €, both with the same result, and the $ or € symbol in the value.
When we remove the symbol, we have to update the form, and the symbol is inserted again.

 

creditmemo.JPG

Best Regards,

Andreas

6 REPLIES 6

Re: Magento 2.4.2-p1 => 2.4.3 creditmemo error: values with currency symbol

Anny solution, I face the same problem...

Re: Magento 2.4.2-p1 => 2.4.3 creditmemo error: values with currency symbol

I am facing the same issue and trying to overcome it. Please share your progress on this.

Re: Magento 2.4.2-p1 => 2.4.3 creditmemo error: values with currency symbol

In case anyone needs a temporary fix for this

 

The 2.4.3 version seems to use $block->formatValue for all the price insertions in that template, while it does tell the code to not include the currency symbol, it's not working for us either. Going back to an older version you should be able to replace:

 

$block->formatValue

with 

$block->escapeHtmlAttr

 

In this file:

 

vendor/magento/module-sales/view/adminhtml/templates/order/creditmemo/create/totals/adjustments.phtml

 

Not sure if it will be patched but hopefully this will help anyone having this issue

 

Re: Magento 2.4.2-p1 => 2.4.3 creditmemo error: values with currency symbol

We also encounter the problem when attempting to create a credit memo in Magento 2.4.3-p1.

Although the \Magento\Sales\Block\Adminhtml\Order\Creditmemo\Create\Adjustments::formatValue specifies that no currency symbol should be printed (['display' => Zend_Currency::NO_SYMBOL]), the \Magento\Directory\Model\Currency::formatCurrency function does not strip the currency symbol. To strip the currency symbol you could apply the following patch. 

 

--- vendor/magento/module-directory/Model/Currency.php	2021-10-06 14:52:40.000000000 +0200
+++ vendor/magento/module-directory/Model/Currency.php	2021-10-06 14:51:00.000000000 +0200
@@ -431,6 +431,7 @@
         if ((array_key_exists(LocaleCurrency::CURRENCY_OPTION_DISPLAY, $options)
                 && $options[LocaleCurrency::CURRENCY_OPTION_DISPLAY] === \Magento\Framework\Currency::NO_SYMBOL)) {
             $formattedCurrency = str_replace(' ', '', $formattedCurrency);
+            $formattedCurrency = str_replace($this->getCurrencySymbol(), '', $formattedCurrency);
         }

         return preg_replace('/^\s+|\s+$/u', '', $formattedCurrency);

 

Note: It is never best practice to edit core files. To apply this patch you should override the \Magento\Directory\Model\Currency class by a new preference, because the function \Magento\Directory\Model\Currency::formatCurrency is private. Alternatively, you can apply the patch using composer in the "scripts.post-install-cmd" (assuming that the patch is stored in patches/vendor-magento-module-directory-Model-Currency.patch):

 

composer.json 

"scripts": {
"post-install-cmd": [
...
"patch --forward --dry-run vendor/magento/module-directory/Model/Currency.php patches/vendor-magento-module-directory-Model-Currency.patch > /dev/null && patch --forward vendor/magento/module-directory/Model/Currency.php patches/vendor-magento-module-directory-Model-Currency.patch > /dev/null || echo \"\\033[1;34m skipping patch \\033[0m\"",
...
]
}

 

Re: Magento 2.4.2-p1 => 2.4.3 creditmemo error: values with currency symbol

I'm facing the problem too. wait for official solution.

Re: Magento 2.4.2-p1 => 2.4.3 creditmemo error: values with currency symbol