• Resolved wipx


    Is there a way to remove the + sign from the output being sent. Since we are using API the input field receiving the number are already configured with the + sign

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Yordan Soares


    Hello @wipx,

    The easiest way to do that is using telephone parts mail-tags this plugins provides in your mail panel instead the default mail-tag (that returns the complete number including the plus symbol: +):

    • [{your-phone}-cf7it-country-code]: It prints the country code of the phone number. For the example above: 1
    • [{your-phone}-cf7it-national]: It prints the phone number without international prefix. For the example above: 5551234567

    You need to replace {your-phone} part of mail-tags with the name of your form-tag. This is an example of how it’s use:

    Customer Phone: [your-phone-cf7it-country-code][your-phone-cf7it-national]

    Another way is to remove the symbol before the mail processing. To achieve this you can use this code in the functions.php file of your active theme or in a custom plugin:

    	function ($replaced, $submitted, $html, $mail_tag) {
    		if ('your-phone' == $mail_tag->field_name()) {			
    				$replaced = preg_replace('+', '', $replaced);			
    		return $replaced;

    You needs to replace 'your-phone' with the name of your phone form-tag. In both method, you’ll get a mail with something like this:

    Customer Phone: 15551234567

    I hope it’s useful to you.

    Thread Starter wipx


    Thank you for your suggestions and for providing two alternatives.

    Option one works well for email, the downside is that it is losing some formatting, for example spaces are allowed. Since we are using API, I can only insert one code at a time..? (Example ‘request_number’ => $posted_data[‘phone-number-cf7it-country-code’],)

    I don’t get option two to work, if I replace ‘your-phone’ with ‘phone-number’ the output is ‘[phone-number]. I have tried all kind of variations of form and mail tags.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove + from output’ is closed to new replies.