Checkout fields – Make billing_address_2 above billing_address_1

Solution:

Update (related to your comment)…

Here you have an addition that removes “Address” text label from Address1 field and set it to Address2 field, making also that field (optionally) required and changing a little bit the place holder… I have also another solution (see below after the code).

Here is the code:

add_filter( 'woocommerce_checkout_fields', 'custom_billing_fields_order' );
function custom_billing_fields_order( $fields ) {

    // 1. Customizing address_1 and address_2 fields
    $fields['billing']['billing_address_1']['label'] = ''; // Removing the label from Adress1
    $fields['billing']['billing_address_2']['label'] = __('Address', 'theme_domain');
    $fields['billing']['billing_address_2']['required'] = true; // Making Address 2 field required
    $fields['billing']['billing_address_2']['placeholder'] = __('Apartment, suite, unit etc...', 'woocommerce');

    // 2. Custom ordering the billing fields array (toggling address_1 with address_2)
    $custom_fields_order = array(
        'billing_first_name', 'billing_last_name',
        'billing_company',
        'billing_email',      'billing_phone',
        'billing_country',
        'billing_address_2',  'billing_address_1',  ##  <== HERE, changed order
        'billing_postcode',   'billing_city'
    );

    foreach($custom_fields_order as $field)
        $new_ordered_fields[$field] = $fields['billing'][$field];

    // Replacing original fields order by the custom one
    $fields['billing'] = $new_ordered_fields;


    // Returning Checkout customized billing fields order
    return $fields;
}

Instead of toggling that 2 fields, you could invert the fields placeholders and add make (optionally) required the field Address2, so you will not need to reorder the fields. You can do it this way:

add_filter( 'woocommerce_checkout_fields', 'custom_billing_fields_placeholders' );
function custom_billing_fields_placeholders( $fields ) {

    // 1. Customizing address_1 and address_2 fields
    $fields['billing']['billing_address_1']['placeholder'] = __('Apartment, suite, unit etc...', 'woocommerce');
    $fields['billing']['billing_address_2']['required'] = true; // Making Address 2 field required
    $fields['billing']['billing_address_2']['placeholder'] = __('Street address', 'woocommerce');

    // Returning Checkout customized billing fields
    return $fields;
}

Code goes in function.php file of your active child theme (or theme) or also in any plugin file.

Code is tested and works.