Skip to main content

I have a design where I need to display prices with 6 digits. When I use the variable type numbers for this, prices appear without thousands separators.

I would like to display 61,135.25 instead of 61135.25


Keep in mind that there are different rules for thousands separators and decimal separators in different parts of the world. For example, in Denmark it would look like this 61.135,25. For the clients, their prices shown correct is a big deal. So I can’t use variable numbers for this for now.


Something like this would be much welcome 🙂

I second this.


Hi @Christian_Brandt, I just wanted to say that you can easily do this with my plugin!


I made a video showing it in action:



So basically the #NumberDenmark variable depends on the #NumberBase, and it’s formula is:

{{ fn($NumberBase, "dk") }}.

where fn is a function that formats the number with the locale “dk” (Denmark’s country code), and it’s a shorthand for the JavaScript’s `Number.toLocaleString’.


Later in the video, you can also see the more advanced example with the usage of modes,

related formulas:

#Delimited = {{ fn($Number, "$$.mode", { minimumFractionDigits: 2 }) }}.

$$.mode - gets the current mode for the variable, and mode is the locale name in this case, so it calls the fn function with the “dk”, “de”, “fr” and “en” locales.

#Price = {{ fn($Number, "$$.mode", { style:"currency", currency: "$Currency" }) }}

This one passes the style of “currency” with the $Currency variable, which is “DKK”, “EUR” or “USD”.


Plugin:

Figma

SIr i am still facing the issue i cant divided my numarical value after 2 digit


Reply