Within Settings, the cart currency is set to Euros. But when I use:
{{ product.defaultVariant.price | currency(cart.currency) }}
The output is:
¤150.49
Anyone encountered this before?
What does cart.currency
return?
The Twig currency
filter ultimately uses Yii's CNumberFormatter
class. This uses the symbol you are seeing as a default placeholder for the currency symbol if one cannot be determined from the value of the $currency
parameter passed to it. This would indicate that the value of cart.currency
is not as expected. You'll need to make sure that the cart
variable is being set correctly in your template, then this should work.
As Steve mentions, most likely this is because the font you are using on the front-end of your site doesn't know how to display the € symbol.
I just tested on a fresh Craft/Commerce install on OSX/Chrome and the default Commerce templates display € as expected.
cart.currency
return? Looking through the code, the Twigcurrency
filter ultimately uses Yii'sCNumberFormatter
class. This uses the symbol you are seeing as a default placeholder for the currency symbol if one cannot be determined from the value of the$currency
parameter passed to it. See here: yiiframework.com/doc/api/1.1/CNumberFormatter#format-detail This would indicate that the value ofcart.currency
is not as expected. How is this being set?