If user is not logged in,there is a registration form on cart page,when submitting, it is redirecting to "my-account page". I want to redirect it to cart page. I have tried so many ways,but did not work.It is forcefully redirecting on my-account. Need Help !
Asked
Active
Viewed 1,702 times
1 Answers
-1
Did you try this?
function custom_registration_redirect() {
global $woocommerce;
$cart_url = $woocommerce->cart->get_cart_url();
wp_redirect($cart_url);
exit();
}
add_action('woocommerce_registration_redirect', 'custom_registration_redirect', 2);

Vel
- 9,027
- 6
- 34
- 66
-
Yes i have tried this , but still is redirecting it to my-account – Shweta Danej Dec 23 '17 at 05:47
-
In class-wc-form-handler i print_r() the $redirect , it is showing me cart url , but anyhow it redirects to the my-account – Shweta Danej Dec 23 '17 at 05:50
-
did you check the settings in admin? https://i.stack.imgur.com/iIKx2.png – Vel Dec 23 '17 at 05:53
-
Enable customer registration on the "My account" page. was not checked , i checked it and test it. It is still not working – Shweta Danej Dec 23 '17 at 05:57
-
it is custom registration form or woocomerce registraion? – Vel Dec 23 '17 at 06:00
-
Nope, I fixed it. – Shweta Danej Dec 23 '17 at 06:04
-
1Above given code is working perfectly – Shweta Danej Dec 23 '17 at 06:10
-
you are welcome. I updated my answer. – Vel Dec 23 '17 at 06:19