Change order of billing fields on woo-commerce checkout page

We can change fields order based on priority please find below code to change FIELD ORDER

add_filter(“woocommerce_checkout_fields”, “order_fields”);

function order_fields($fields) {

$fields[‘billing’][‘billing_first_name’][‘priority’] = 1;
$fields[‘billing’][‘billing_last_name’][‘priority’] = 2;
$fields[‘billing’][‘billing_company’][‘priority’] = 3;
$fields[‘billing’][‘billing_email’][‘priority’] = 4;
$fields[‘billing’][‘billing_phone’][‘priority’] = 5;
$fields[‘billing’][‘billing_country’][‘priority’] = 6;
$fields[‘billing’][‘billing_address_1’][‘priority’] = 7;
$fields[‘billing’][‘billing_address_2’][‘priority’] = 8;
$fields[‘billing’][‘billing_city’][‘priority’] = 9;
$fields[‘billing’][‘billing_state’][‘priority’] = 10;
$fields[‘billing’][‘billing_postcode’][‘priority’] = 11;

return $fields;
}

Advertisements