• Resolved risecompany

    (@risecompany)


    Hi,
    We have an issue with email field if entered accidentally with spaces
    it return with error Invalid email address , that make the user confused
    and don’t know what is the issue come from .

    we used a function to Automatically remove spaces from email field but it’s not working . any help please ?

    add_filter( ‘woocommerce_checkout_fields’ , ‘remove_spaces_in_email’ );
    function remove_spaces_in_email( $fields ) {
    $fields[‘billing’][‘billing_email’]= str_replace(‘ ‘,”,$fields[‘billing’][‘billing_email’]);
    return $fields;
    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Not sure if I get this correctly, I was checking in my testing site that is using WooCommerce, Storefront theme and Stripe, I added an order with the email [email protected] (with a space at the beginning) and the order is created (The extra space is removed).

    If I add an email like my [email protected] with a space in the middle, after the validation I got an error:

    Invalid billing email address

    To get a better idea about the configuration your site is using, please share a copy of your site’s System Status Report: You can find it via WooCommerce > Status. Select “Get system report” and then “Copy for support”.?

    Thread Starter risecompany

    (@risecompany)

    Thank you for your help, I found the cause of that issue was come from another gateway called paymob a local bad gateway coded I had added before beside stripe made that conflict , after disabling it , The order created with no issue with white space.

    Roxy

    (@roxannestoltz)

    Hi @risecompany ,

    Glad to hear that you managed to find the culprit causing this behavior.

    I will go ahead and mark this as resolved then. Feel free to create a new topic if you need further help ??

    Cheers!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Invalid email address! If entered accidentally with spaces’ is closed to new replies.