Skip to content

Instantly share code, notes, and snippets.

@mijimoco
Created December 1, 2016 13:30
Show Gist options
  • Save mijimoco/20d14c63247bb1e14e31d652e81266a2 to your computer and use it in GitHub Desktop.
Save mijimoco/20d14c63247bb1e14e31d652e81266a2 to your computer and use it in GitHub Desktop.
Woocommerce checkout form - Reorder billing fields
/*
* Reorder Billing Field
*/
add_filter( 'woocommerce_checkout_fields', 'reorder_billing_fields');
function reorder_billing_fields($fields) {
$order = array(
'billing_first_name',
'billing_last_name',
'billing_company',
'billing_tongbian', //this is a custom field, we added this before, seperately
'billing_address_1',
'billing_email',
'billing_phone'
);
foreach($order as $field)
{
$ordered_fields[$field] = $fields['billing'][$field];
}
$fields['billing'] = $ordered_fields;
return $fields;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment