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.

Deepak MageDivine
  • 507
  • 1
  • 5
  • 23
  • seems like a css issue maybe, if PDP have some custom work then you need to check those files – Aziz Kapasi Jan 08 '24 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 Jan 08 '24 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 Jan 23 '24 at 11:58
  • @Magedivine Please check this link: https://magento.stackexchange.com/a/371827/82670 If it's not working, please check with the default theme and inform me. – Msquare Jan 23 '24 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. – Claims Jan 26 '24 at 13:01
  • @Magedivine Have you checked my updated answer? – Msquare Jan 29 '24 at 07:31
  • Hi @Msquare, I tested the latest solution today & it seems to be working fine. – Deepak MageDivine Jan 29 '24 at 10:53

2 Answers2

1

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

Msquare
  • 9,063
  • 7
  • 25
  • 63
  • Hi @Msquare, I tried the same solution but didn't work for me. Let me review other links provided by you. – Deepak MageDivine Jan 24 '24 at 04:13
  • @Magedivine Once you are done, please inform me whether it works or not. – Msquare Jan 24 '24 at 07:11
  • I have tried other links as well but the issue remains the same. – Deepak MageDivine Jan 24 '24 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 Jan 26 '24 at 08: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 Jan 29 '24 at 10:55
  • Yes @Magedivine , you can find more information from this link: https://github.com/magento/magento2/issues/33856 – Msquare Jan 29 '24 at 14:38
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.

Deepak MageDivine
  • 507
  • 1
  • 5
  • 23