This is visible in the woocommerce-pos-pro Products screen when WC decimal separator is a comma ",".
[ in Admin ]
[ in POS Products List Variation drawer ]
This seems to be happening because
the prices for variations are strings in the model
the prices decimal separator is a dot "."
the formatting function from the accounting library removes the dot because it has been set to use comma as decimal separator (line 197 of accounting.js):
// Build regex to strip out everything except digits, decimal point and minus sign:
var regex = new RegExp("[^0-9-" + decimal + "]", ["g"])
This does not happen when prices are of type number because the formatting function skips the cleaning process
// Return the value as-is if it's already a number:
if (typeof value === "number") return value;
To fix, either:
parseFloat all values in WC Pos Utils.formatNumber function
make sure all prices are of the number type in models
This is visible in the
woocommerce-pos-pro
Products screen when WC decimal separator is a comma","
.[ in Admin ]![image](https://cloud.githubusercontent.com/assets/1503822/23094755/03556d84-f5ff-11e6-9200-4fb4865dcd1c.png)
[ in POS Products List Variation drawer ]![image](https://cloud.githubusercontent.com/assets/1503822/23094777/5aeff5d2-f5ff-11e6-9142-a9b7ef14167e.png)
This seems to be happening because
accounting
library removes the dot because it has been set to use comma as decimal separator (line 197 ofaccounting.js
):This does not happen when prices are of type
number
because the formatting function skips the cleaning processTo fix, either:
parseFloat
all values in WC PosUtils.formatNumber
functionnumber
type in models