We are experiencing an issue with one of the store PDP page, where the currency sign is not showing after the page loads.
During PDP page loading, the currency symbol is displayed, but after successful loading, only the price is shown without the currency symbol.
Some information about the store:
This is a multi-website, multistore, and multi-currency implementation within the same store.
If anyone has faced the same issue or has a solution, please share. Any help would be appreciated.
Note: The issue is only on the PDP page & nothing logged to the log files.
-
seems like a css issue maybe, if PDP have some custom work then you need to check those filesAziz Kapasi– Aziz Kapasi2024年01月08日 12:23:13 +00:00Commented Jan 8, 2024 at 12:23
-
There is no issue with the CSS. The currency symbol has been completely removed from the page's HTML after the page load.Deepak MageDivine– Deepak MageDivine2024年01月08日 12:26:30 +00:00Commented Jan 8, 2024 at 12:26
-
The issue seems to be most probably occurring because of some javascript (most probably custom javascript) as php only handles backend and if the the view is being changed during or after page render it would be js. It would depend on what code is running on the website so if you can point out the url then we can give you specific instructions otherwise only thing anyone can give is general directions on how to debug the issue.Vivek Kumar– Vivek Kumar2024年01月23日 11:58:39 +00:00Commented Jan 23, 2024 at 11:58
-
@Magedivine Please check this link: magento.stackexchange.com/a/371827/82670 If it's not working, please check with the default theme and inform me.Msquare– Msquare2024年01月23日 15:19:26 +00:00Commented Jan 23, 2024 at 15:19
-
do you have varnish installed ? I've already faced such an issue with varnish loading two times the website with 2 different cache. Depending on which one is loading first and which one is loading second, it might print it or not. If you do have varnish installed i would recommend you to test to disable it just for testing purpose and see if the error persist.Clong– Clong2024年01月26日 13:01:48 +00:00Commented Jan 26, 2024 at 13:01
2 Answers 2
Yes, I also faced the same issue some years ago on the LIVE server, where the currency symbol was not showing on the entire website without any error log. I unchecked the box, saved the configuration, cleared the cache, and it worked fine without any issues.
Maybe this will be helpful for you.
Path : Stores -> Currency -> Currency Symbols
If it's not resolved, please check the GitHub issue below. It is a similar issue to what you are facing.
Links:
- https://github.com/magento/magento2/issues/33856
- https://github.com/magento/magento2/issues/33798
- https://github.com/magento/magento2/issues/33856#issuecomment-946761019
Update
The issue originates from the following file:
Path: vendor/magento/module-directory/Model/Currency.php
In the formatTxt() function, please replace the existing code with the following:
/**
* Return formatted currency
*
* @param float $price
* @param array $options
*
* @return string
*/
public function formatTxt($price, $options = [])
{
if (!is_numeric($price)) {
$price = $this->_localeFormat->getNumber($price);
}
/**
* Fix problem with 12 000 000, 1 200 000
*
* %f - the argument is treated as a float, and presented as a floating-point number (locale aware).
* %F - the argument is treated as a float, and presented as a floating-point number (non-locale aware).
*/
$price = sprintf("%F", $price);
return $this->_localeCurrency->getCurrency($this->getCode())->toCurrency($price, $options);
}
This code adjustment should resolve the currency issue on the product page. You can create a custom patch to implement this fix.
GitHub Comment Link: https://github.com/magento/magento2/issues/33856#issuecomment-904606945
For Create Custom Path: https://magento.stackexchange.com/a/368552/82670
-
Hi @Msquare, I tried the same solution but didn't work for me. Let me review other links provided by you.Deepak MageDivine– Deepak MageDivine2024年01月24日 04:13:05 +00:00Commented Jan 24, 2024 at 4:13
-
@Magedivine Once you are done, please inform me whether it works or not.Msquare– Msquare2024年01月24日 07:11:41 +00:00Commented Jan 24, 2024 at 7:11
-
I have tried other links as well but the issue remains the same.Deepak MageDivine– Deepak MageDivine2024年01月24日 10:30:48 +00:00Commented Jan 24, 2024 at 10:30
-
@Magedivine, please review my revised response where I identified and resolved the issue. You can generate a custom patch to implement the fix. Additionally, I included a comment from a GitHub user that might provide further assistance.Msquare– Msquare2024年01月26日 08:53:08 +00:00Commented Jan 26, 2024 at 8:53
-
Yes the custom patch is working fine. The additional code in the formatTxt function was creating the issue. But how the same code is working fine in M2.4.6.Deepak MageDivine– Deepak MageDivine2024年01月29日 10:55:09 +00:00Commented Jan 29, 2024 at 10:55
Looks like the issue was fixed by Magento internal team in the following commit ae304d4. This is the correct solution.
Please note, the solution is for Magento 2.4.3 & it was already fixed in Magento 2.4.
Explore related questions
See similar questions with these tags.