I have rearranged the order fields on the Woocommerce checkout page with this function:
//Reorder checkout
add_filter( 'woocommerce_checkout_fields', 'reorder_woo_fields' );
function reorder_woo_fields( $fields ) {
$fields2['billing']['billing_first_name'] = $fields['billing'] ['billing_first_name'];
$fields2['billing']['billing_last_name'] = $fields['billing']['billing_last_name'];
$fields2['billing']['billing_company'] = $fields['billing']['billing_company'];
$fields2['billing']['billing_address_1'] = $fields['billing']['billing_address_1'];
$fields2['billing']['billing_city'] = $fields['billing']['billing_city'];
$fields2['billing']['billing_postcode'] = $fields['billing']['billing_postcode'];
$fields2['billing']['billing_country'] = $fields['billing']['billing_country'];
$fields2['billing']['billing_email'] = $fields['billing']['billing_email'];
$fields2['billing']['billing_phone'] = $fields['billing']['billing_phone'];
$fields2['shipping']['shipping_first_name'] = $fields['shipping']['shipping_first_name'];
$fields2['shipping']['shipping_last_name'] = $fields['shipping']['shipping_last_name'];
$fields2['shipping']['shipping_company'] = $fields['shipping']['shipping_company'];
$fields2['shipping']['shipping_address_1'] = $fields['shipping']['shipping_address_1'];
$fields2['shipping']['shipping_city'] = $fields['shipping']['shipping_city'];
$fields2['shipping']['shipping_postcode'] = $fields['shipping']['shipping_postcode'];
$fields2['shipping']['shipping_country'] = $fields['shipping']['shipping_country'];
// Add full width Classes and Clears to Adjustments
$fields2['billing']['billing_first_name'] = array(
'label' => __('First Name', 'woocommerce'),
'class' => array('form-row-wide'),
'clear' => true,
'required' => true
);
$fields2['billing']['billing_last_name'] = array(
'label' => __('Last Name', 'woocommerce'),
'class' => array('form-row-wide'),
'clear' => true,
'required' => true
);
$fields2['shipping']['shipping_first_name'] = array(
'label' => __('First Name', 'woocommerce'),
'class' => array('form-row-wide'),
'clear' => true,
'required' => true
);
$fields2['shipping']['shipping_last_name'] = array(
'label' => __('Last Name', 'woocommerce'),
'class' => array('form-row-wide'),
'clear' => true,
'required' => true
);
return $fields2;
}
and this works, but when enabling debug mode I am getting an error on the chekcout page: Notice: Undefined index: order in /html/wordpress/wp-content/plugins/woocommerce/templates/checkout/form-shipping.php on line 58
Warning: Invalid argument supplied for foreach() in /html/wordpress/wp-content/plugins/woocommerce/templates/checkout/form-shipping.php on line 58
Can aynone make sense of this?