Support

Account

Home Forums Backend Issues (wp-admin) Showing number with 00 on decimals

Solving

Showing number with 00 on decimals

  • Hi,

    I’m developing a site that requires prices to show in the following format: $20.00.

    When I add the price as 20.00 on the number field the two zeros and the decimal point get stripped, I know the decimals work because if I use for example 20.34 the 34 remains and get displayed fine.

    Is there any way of keeping 00 on the decimals as part of the value of the field?

  • Hi @dianaavila

    The number input field will remove 00 values. This is a HTML5 behavior which I cannot fix.

    The work around is to use a text input instead.

    Thanks
    E

  • it’s either that or you’ll have to check if the price has decimals or not when adding them to your theme files and if not add .00 to the field value 🙂

    (if you go this route I highly suggest you create a function for it in functions.php and call it on each place in the theme files instead of writing the same code repeatedly)

  • Hi,

    in my case, I can’t add 20.34 into the field with number field type.

    Is there I miss something while I creating new fields in Field Group?

  • manellen, remove the fracion and it works.
    I’m have this same “problem”

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Showing number with 00 on decimals’ is closed to new replies.