How can I remove non-numeric characters from my Shopify data?
We have a function called strip_non_numeric_chars() which you can use in the Calculated Fields that will take care of this for you automatically.
The usage is very simple. For example, if you have a shipping address phone number like +1 (555) 209-4427
and you want to only export the numbers, you can use this formula:
strip_non_numeric_chars({{ shipping_address.phone }})
The above formula will return: 15552094427
There's an option to make an exception for certain characters as well. If you want to keep the "+" character for instance, you can slightly modify the formula to this instead:
strip_non_numeric_chars({{ shipping_address.phone }}, except_chars="+")
This will return just the numbers and the plus sign: +15552094427
You can make exceptions for multiple characters. The formula below will make an exception for both the "+" and "-" characters:
strip_non_numeric_chars({{ shipping_address.phone }}, except_chars="+-")
This will output: +1555209-4427
Related Articles:
App: EZ Exporter
Tags: shopify, advanced features, formatting