Woocommerce Edit Message "An account is already registered with your email address. Please log in."



PHP Snippet 1:

add_filter( 'woocommerce_registration_error_email_exists', function( $html ) {
    $url =  wc_get_page_permalink( 'myaccount' );
    $url = add_query_arg( 'redirect_checkout', 1, $url );
    $html = str_replace( 'An account is already registered with your email address. Please log in', '<a href="'.$url.'"><strong>YOUR CUSTOM TEXT</strong></a>', $html );
    return $html;
} );

PHP Snippet 2:

if ( email_exists( $email ) ) {
return new WP_Error( 'registration-error-email-exists', apply_filters( 'woocommerce_registration_error_email_exists', __( 'An account is already registered with your email address. <a href="#" class="showlogin">Please log in.</a>', 'woocommerce' ), $email ) );
}

PHP Snippet 3:

/** Replace 'An account is already registered with your email address. Please log in.' **/
add_filter( 'woocommerce_registration_error_email_exists', function() {
    return 'Este înregistrat deja un cont cu adresa ta de e-mail. <a href="#" class="showlogin">Te rug?m s? te autentifici.</a>';
} );

PHP Snippet 4:

add_filter( 'woocommerce_registration_error_email_exists', function( $html ) {
    $html = str_replace( 'An account is already registered with your email address. <a href="#" class="showlogin">Please log in.</a>', 'TEXT1. <a href="#" class="showlogin">TEXT2.</a>', $html );
    return $html;
} );