//Redirect after registration
add_filter( 'woocommerce_registration_redirect', 'custom_redirection_after_registration', 10, 1 );
function custom_redirection_after_registration( $redirection_url ){
if ( WC()->cart->get_cart_contents_count() == 0 ) {
$redirection_url = get_permalink( wc_get_page_id( 'shop' ) );
}else{
// Change the redirection Url
$redirection_url = wc_get_checkout_url(); //Checkout
}
return $redirection_url; // Always return something
}
/*
"Home" Url: $redirection_url = get_home_url();
"Shop" Url: $redirection_url = get_permalink( wc_get_page_id( 'shop' ) );
"Cart" Url: $redirection_url = wc_get_cart_url();
"Checkout" Url: $redirection_url = wc_get_checkout_url();
"Account" $redirection_url = get_permalink( wc_get_page_id( 'myaccount' ) );
"ID": $redirection_url = get_permalink( $post_id );
(where $post_id is the id of the post or the page)
Get post or pages by path (example): $redirection_url = home_url('/product/ninja/');
*/