1

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.

asked Jan 8, 2024 at 12:19
7
  • seems like a css issue maybe, if PDP have some custom work then you need to check those files Commented 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. Commented 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. Commented 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. Commented 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. Commented Jan 26, 2024 at 13:01

2 Answers 2

1
+50

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

enter image description here

If it's not resolved, please check the GitHub issue below. It is a similar issue to what you are facing.

Links:

  1. https://github.com/magento/magento2/issues/33856
  2. https://github.com/magento/magento2/issues/33798
  3. 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

answered Jan 23, 2024 at 15:17
6
  • Hi @Msquare, I tried the same solution but didn't work for me. Let me review other links provided by you. Commented Jan 24, 2024 at 4:13
  • @Magedivine Once you are done, please inform me whether it works or not. Commented Jan 24, 2024 at 7:11
  • I have tried other links as well but the issue remains the same. Commented 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. Commented 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. Commented Jan 29, 2024 at 10:55
0

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.

answered Jan 29, 2024 at 12:07

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.