1

I want to redirect users to account details after registering, by default it is redirecting to my account dashboard.

This is where I want users to be redirected

mydomain.com/my-account/edit-account/

I found something like this, but I think it won't work

function iconic_register_redirect( $redirect ) {
    return wc_get_page_permalink( '' );
}

add_filter( 'woocommerce_registration_redirect', 'iconic_register_redirect' );
1

To get "Account details" permalink (endpoint edit-account) you need to use function wc_get_account_endpoint_url.

function wc_redirect_to_account_details( $redirect ) {
    $redirect = wc_get_account_endpoint_url('edit-account');
    return $redirect;
}
add_filter( 'woocommerce_registration_redirect', 'wc_redirect_to_account_details' );
0
function woo_login_redirect( $redirect, $user ) {
$redirect_page_id = url_to_postid( $redirect );
$checkout_page_id = wc_get_page_id( 'checkout' );

if( $redirect_page_id == $checkout_page_id ) {
    return $redirect;
}

return wc_get_page_permalink( 'shop' );
}
add_filter( 'woocommerce_login_redirect', 'woo_login_redirect' );

Use this function to redirect users after login

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.