Strange issue with [calc]
-
I have a post-type called “accounts” with an ACF numeric field called “value” I use to store a certain amount in different currencies (let’s say USD, GBP, CAD).
I want to convert all of them in USD and sum them.
To convert them I use another plugin called Open Currency Converter. It requires the following syntax:
[convert number=123 from="gbp" to="usd"]
The number that is stored in the “value” field has no separator for thousands. Example: 1246.8074 (this is one thousands, two hundreds, fortysix).
The number returned by the converter plugin uses , to show the thousands:
Example: 1,246.8074 (this still is one thousands, two hundreds, fortysix).When I try to add the “value” amount to the converted amount, the latter is considered in a completely different way:
[pass vars] [calc][field value] + [convert number={VALUE} from="gbp" to="usd"][/calc] [/pass]
If value = 0 and the converted value = 1,246.8074, I’d expect [calc] to return: 1,247.8074.
Instead, [calc] returns: 1.
Not only it wrongly assumes that a thousand is a single unit, but it also hides all decimals.
I was thinking about using [format] to remove the , from the converted value, but I can’t find the right syntax to eliminate it.
Am I missing something?
Thank you.
- The topic ‘Strange issue with [calc]’ is closed to new replies.