I need to change the sorting of the checkout fields.
Added filter woocommerce_checkot_fields, but does not work.
add_filter( 'woocommerce_checkout_fields', 'custom_order_checkout_fields' );
function custom_order_checkout_fields( $checkout_fields ) {
$checkout_fields['billing']['billing_first_name']['priority'] = 10;
$checkout_fields['billing']['billing_company']['priority'] = 20;
$checkout_fields['billing']['billing_email']['priority'] = 30;
$checkout_fields['billing']['billing_phone']['priority'] = 40;
$checkout_fields['billing']['billing_country']['priority'] = 50;
$checkout_fields['billing']['billing_postcode']['priority'] = 60;
$checkout_fields['billing']['billing_city']['priority'] = 70;
$checkout_fields['billing']['billing_address_1']['priority'] = 80;
return $checkout_fields;
}
woocommerce_form_field_args adds classes only to the label and input. I need to wrap the required fields inside the container.
There are various plugins, but I would like to know the solution through hooks.
2
Answers
You can achieve this using css like below :-
Your code worked fine with me, but incase you want to remove and set the fields as yours, you can unset the array and re-set it with the same sort, check this: