cancel
Showing results for 
Search instead for 
Did you mean: 

Debugging currency format display advice

Debugging currency format display advice

Hi all,

 

Have been generally successful in managing my Magento install but I am really overwhelming diagnosing this issue and could use some advice. 

For configurable items, my tier pricing is displaying with the wrong currency format.

Example: Buy 10 for 0,10 each

My store is set to USD so it should be $0.10. This is the only place on my entire store I have noticed this issue, the currency appears to be displaying correctly everywhere else. 

Here is my tracing:

  • Firstly I worked my way to the "tier_price.phtml" template file in the configurable product module.
  • That showed me the JS call: priceUtils.formatPrice(item.price, currencyFormat)
  • In my browser console, I inspected the "formatPrice" method during a swatch change. I see that "currentFormat" parameter is set to "$%s" when the method is called. That does not seem to be right though, because at the top of that method there is a line: format = _.extend(globalPriceFormat, format);
    The globalPriceFormat appears to be a default price format where the incorrect formatting is coming from. So it appears the currencyFormat parameter has a wrong value being passed to it. 
  • Next, I tried to find the source of currencyFormat.
    It appears currencyFormat comes from: this.options.jsonConfig.currencyFormat. 

This is where my ability starts to run out. I think the data should be coming from module-configurable-product/Block/Product/View/Type/Configurable.php, but, this is what I see in that file: 

        $config = [
            'attributes' => $attributesData['attributes'],
            'template' => str_replace('%s', '<%- data.price %>', $store->getCurrentCurrency()->getOutputFormat()),
            'currencyFormat' => $store->getCurrentCurrency()->getOutputFormat(),
            'optionPrices' => $this->getOptionPrices(),
            'priceFormat' => $this->localeFormat->getPriceFormat(),

I'm not sure why 
'currencyFormat' => $store->getCurrentCurrency()->getOutputFormat(),
would be result in a value of 
"$%s"

Anyone have any pointers for where I should dig in next?

Thanks! 

3 REPLIES 3

Re: Debugging currency format display advice

Has anyone encountered an issue in Magento where tier pricing for configurable items displays with the wrong currency format? For example, instead of "$0.10", it shows as "0,10". The currency is set to USD, but this issue only occurs in tier pricing. Get more info on this

 

 

 

Re: Debugging currency format display advice

Great insights on debugging currency format display! 💰💻 Ensuring accurate currency formatting is crucial for user experience, especially in e-commerce and financial applications. If you're looking for more tips on optimizing website functionality and user experience, check out our latest insights menu . Clear and precise formatting can make a huge difference in how users interact with pricing and transactions. Thanks for sharing these valuable debugging techniques!

Re: Debugging currency format display advice

It sounds like you're on the right track with debugging the currency format issue in Magento. For complex issues like this, it often helps to trace back through any recent changes to the configuration settings or the codebase. If you're also considering upgrades or improvements to your store’s design, don't forget to check out a reliable kitchen remodel Tacoma WA service to ensure your setup is optimized for both functionality and aesthetics! Good luck with the debugging!