Search code examples
wordpresshttp-redirectwoocommerceaccount

Redirect after registration to WooCommerce "my account" edit address page


So I've got a code that redirects new users to the address section in their account, however now the need has come to instead direct the user to the billing address form itself so they can fill it in.

I thought it would be a simple addition of 'billing' but seems like that isnt it, any help greatly appreciated.

My code:

function iconic_register_redirect( $redirect ) {
    return wc_get_page_permalink( 'my-account','edit-address','billing' );
}
add_filter( 'woocommerce_registration_redirect', 'iconic_register_redirect' );

Solution

  • Just apply it like this:

    function filter_woocommerce_registration_redirect( $redirect ) {
         return wc_get_page_permalink( 'my-account', 'edit-address/billing' );
    }
    add_filter( 'woocommerce_registration_redirect', 'filter_woocommerce_registration_redirect', 10, 1 );