I am looking to overwrite this message via functions.php
through a child’s theme. I have seen some examples through here and here.
I would prefer using a filter but don’t know why is it not working when I add it into functions.php
:
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( 'Please log in', '<a href="'.$url.'"><strong>Please log in</strong></a>', $html );
return $html;
} );
4
Answers
If you want the change the entire message, use this code:
You can do it by changing the line of code in the
woocommerceincludeswc-user-functions.php file. =>Line 47.
after this code
This worked for me (put in your functions.php):
The complete html code includes the anchor tag as well. Add this filter in functions.php file in child theme. You can change the TEXTs as desired.