Home Forums WoodMart support forum One click logout

One click logout

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #36173

    jinsley8
    Participant

    One more question…

    When someone clicks the logout on the My Account dropdown it takes them to the My Account page then asks if they still want to logout.

    How would I change the link to logout right away without the 2nd click prompt? the menu link is /my-account/customer-logout/

    Attachments:
    You must be logged in to view attached files.
    #36195

    Artem Temos
    Keymaster

    Hi,

    This functionality comes with WooCommerce plugin and we are not able to change this behavior in our theme.

    Regards

    #36204

    jinsley8
    Participant

    Actually, I just found this that works. For anyone looking for the same solution:

    // Logout without confirmation.
    function wc_bypass_logout_confirmation() {
      global $wp;
    
      if ( isset( $wp->query_vars['customer-logout'] ) ) {
          wp_redirect( str_replace( '&', '&', wp_logout_url( wc_get_page_permalink( 'home' ) ) ) );
          exit;
      }
    }
    
    add_action( 'template_redirect', 'wc_bypass_logout_confirmation' );
    #36212

    Artem Temos
    Keymaster

    Thank you for sharing a solution here!

    Kind Regards

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘One click logout’ is closed to new replies.