Server side formatting as number not working as expected

I’m doing some simple calculations using numbers, but my numbers keep getting formatted as strings.

For example:

  1. I’m sending a number using $_GET to my server action. ?checkout_id=69&unit_amount=101&tax_behavior=exclusive&tax_pct=21

  2. It became a string
    image
    But I make it a numebr using toNumber() image

  3. I do a calculation with it and use .formatNumber():
    image

  4. My number (price_excluding) is now a string again. image

Does .formatNumber() change my number to a string? Then it’s not a bug, just confusing.

That is how the formatNumber is supposed to work, it returns a string:

As a value like 123.45,00 is not a valid number :slight_smile:

Ah thanks, makes sense.

Which formatter can I use to get a float number?

You can just add .toNumber() at the end of your expression