I've added some WooCommerce checkout form fields to the registration form, since my site requires customer to provide their billing address during registration.

// Custom function to display the Billing Address form to registration page
function rsc_add_billing_form_to_registration(){
    global $woocommerce;
    $checkout = $woocommerce->checkout();
    ?>
    <?php foreach ( $checkout->get_checkout_fields( 'billing' ) as $key => $field ) : ?>

        <?php if ( $key != 'billing_email' && $key != 'billing_phone' && $key != 'billing_tax_exempt_id' && $key != 'billing_verify_email' &&
        $key != 'billing_phone_ext'  ) { 
            woocommerce_form_field( $key, $field, $checkout->get_value( $key ) );
        } ?>

    <?php endforeach; 
}
add_action('woocommerce_register_form_start','rsc_add_billing_form_to_registration');

The State/ZIP fields DO change when the form is submitted but not with some kind of AJAX (I assume) call the way they do on the checkout form.

Is there a hook I need to add to have the address fields update when the customer changes their country the same way it works in checkout?

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.