• Hello peeps !

    I would like to change the confirmation message link after reset password from my lost password page.

    I found the code to change in : woocommerce/includes/shortcodes/class-wc-shortcode-my-account.php

    
    /**
    		 * After reset, show confirmation message.
    		 */
    		} elseif ( ! empty( $_GET['reset'] ) ) {
    			wc_add_notice( __( 'Your password has been reset.', 'woocommerce' ) . ' <a class="button" href="' . esc_url( wc_get_page_permalink( 'myaccount' ) ) . '">' . __( 'Log in', 'woocommerce' ) . '</a>' );
     
    		/**
    

    I don’t want to rewrite these strings directly from Woocommerce plugin.

    How can I override this from my child theme function?

    Adding a filter and an argument like ‘$redirect’ would be the solution right?

    Cheers ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • See “Creating custom translations with Loco Translate” in:
    https://docs.woocommerce.com/document/woocommerce-localization/

    In this context, “translation” includes changing strings to other stings in the same language.

    Thread Starter bluemoonsound

    (@bluemoonsound)

    Hi Lorro

    Thank you for your reply. However, I don’t think you understood properly my request. There is no translations I want to do with this code.

    I’m just looking for changing the button link, as a redirection, from the confirmation message after reset password.

    Sorry, I didn’t understand.

    Try something like this in functions.php for your child theme:

    
    add_filter( 'woocommerce_get_myaccount_page_permalink', 'my_function', 10);
    function my_function( $link ) {
      if (! empty ($_GET['reset']) ) {
        // $link = 'https://my-new-link';
      }
      return $link;
    }
    
    Thread Starter bluemoonsound

    (@bluemoonsound)

    No worries.

    That’s a good idea but I don’t want to change all ‘myaccount’ permalinks. Only this very one.

    Do you have any idea with another filter?

    For exemple, I’m using that one to change the button link from the added item message on my basket page :

    /* Custom redirect for users after clicking 'return to shop' - My basket page - message after added item */
    add_filter('woocommerce_continue_shopping_redirect', 'change_woocommerce_continue_shopping_redirect_url');
    function change_woocommerce_continue_shopping_redirect_url( $redirect ) {
         $redirect = 'https://exemple.com/';
         return $redirect;
    }

    The function checks for “reset” in the query string and will only change the myaccount link if “reset” exists, otherwise the myaccount link is returned unchanged.

    Thread Starter bluemoonsound

    (@bluemoonsound)

    Sorry I didn’t the ‘reset’ argument.

    That’s brilliant, thanks a lot!

    ingbas

    (@ingbas)

    Hello bluemoonsound,

    I’m looking for the same fix.
    After password reset, I would like to redirect the customer to the my-account-page or a different page. Can you share the working code for my child-theme functions.php file?

    Ingrid

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Change confirmation message link after reset password’ is closed to new replies.