Login / Register - Redirect to same page (WooCommerce).


I'm using the [woocommerce_my_account] shortcode as a login / register form when user is not logged in and tries to pay for a custom created order. (/checkout/order-pay/12345?pay_for_order=true&key=order_examplekey1234)


// If checkout registration is disabled and not logged in, the user cannot checkout
if ( ! $checkout->enable_signup && ! $checkout->enable_guest_checkout && ! is_user_logged_in() ) {
	echo apply_filters( 'woocommerce_checkout_must_be_logged_in_message', __( 'You must be logged in to checkout.', 'woocommerce' ) );
	echo do_shortcode( '[woocommerce_my_account]' );
	echo "<br/>";

Currently it redirects the users to /account page after login on the /checkout/order-pay/ page. Any ideas on how to redirect the user to the current page (order) they were on when they logged in / registered?