0

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"

ktm_
  • 1

1 Answers1

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