So many different answers! I tried many of them. They didn’t work. Here’s what did, and I simply used the examples at https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/ to make them work:
I wanted to move the email field to the top, and place the phone number field below the name (first name, last name). I also wanted to remove the COMPANY field. Here’s a quick tip: The DEFAULT setup assigns a value to each field. So… FIRST NAME = 10, LAST NAME = 20, and so on. Got it? Good. So if you want to make something appear before the FIRST NAME field, assign it a smaller value.
Here’s the code I used to effect what I wanted:
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
$fields['billing']['billing_email']['priority'] = 9;
$fields['billing']['billing_phone']['priority'] = 21;
// Remove company field //
unset($fields['billing']['billing_company']);
return $fields;
}
Simple. Effective. No loops required.