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

Update shipping legacy flat rate label text when shipping cost “0”

Update shipping legacy flat rate label text when shipping cost ( Zero )”0″

function wc_update_flat_rate_label( $rates, $package ) {
if($rates[‘legacy_flat_rate’]->cost == 0){
$rates[‘legacy_flat_rate’]->label = “Free shipping”;
}
return $rates;
}
add_filter( ‘woocommerce_package_rates’, ‘wc_update_flat_rate_label’, 10, 2 );