I am trying to reorder the billing fields on the checkout page but everything I tried so far is not working.
Here is the snippet I am currently trying:
The ordering(sorting) works on address-i18n.min.js not in php code.
In my case, I did something wrong on my js code. So, the ordering didn't work well( javascript stop there ).
Please check dev console and js error.
And this is php code which change only priority.
function rpf_edit_default_address_fields($fields) {
/* ------ reordering ------ */
$fields['country']['priority'] = 10;
$fields['first_name']['priority'] = 20;
$fields['last_name']['priority'] = 30;
$fields['address_1']['priority'] = 40;
$fields['address_2']['priority'] = 50;
$fields['city']['priority'] = 60;
$fields['state']['priority'] = 70;
$fields['postcode']['priority'] = 80;
return $fields;
}
add_filter( 'woocommerce_default_address_fields', 'rpf_edit_default_address_fields', 100, 1 );
Good Luck!