1

I'm working on a multi-lingual site and we need to output costs for products. This is NOT a Craft Commerce site however. I need to show different costs per site depending on the location and different currencies. It feels like this should be possible to do with the money field as it is a number field with a currency assigned. However you can only change the currency globally on the field settings as far as I can tell...

Is there any way to allow content editors to change the currency for the money field per site or is the only way to do this with a number field and separate drop down selector and output our own currencies?

I'm sure this makes sense to be achievable with the money field...maybe I'm missing something obvious!?

Many thanks!

1 Answer 1

1

I would use a number field with two floating point values and make it translatable (I think you already did that).

To format it, you could try Craft's currency filter. To change the currency according to locale, you can try the translation filter.

{{ entry.YOUR_MONEY_FIELD|currency('USD'|t) }}
{# Output: $1,000,000.00 #}
// translations/de/site.php
<?php

return [
    "USD" => "EUR",
]

// translations/jp/site.php
<?php

return [
    "USD" => "JPY",
]

I never tried it but use the same pattern for date translations. Hope it works.

P.S. In case this works, you could use the same pattern to translate the text (currency) of your backend field.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.