I'm setting up an express checkout solution on shopify and I want to convert the total cart price that shopify shows the user (in text) into a number with any point, coma, space or currency. From this "15.90 €" to this "1590"
Asked
Active
Viewed 67 times
1 Answers
2
Just replace every non-numeric character to empty character
var str = "15.90€"
str = str.replace(/[^0-9]/g, '')
console.log(str)

Dominik Matis
- 2,086
- 10
- 15