Created
December 1, 2016 13:30
-
-
Save mijimoco/20d14c63247bb1e14e31d652e81266a2 to your computer and use it in GitHub Desktop.
Woocommerce checkout form - Reorder billing fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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