In WooComerce file class-wc-form-handler.php
I wanted to override in my child theme just one line where the variable $redirect
.
What is the best practice in this case ?
class-wc-form-handler
public function process_registration() {
if ( ! empty( $_POST['register'] ) ) {
...
// Redirect
if ( wp_get_referer() ) {
$redirect = esc_url( wp_get_referer() );
} else {
//$redirect = esc_url( get_permalink( wc_get_page_id( 'myaccount' ) ) );
$redirect = home_url() . $_SERVER["REQUEST_URI"];
}
wp_redirect( apply_filters( 'woocommerce_registration_redirect', $redirect ) );
exit;
}