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!