Example — I would like to make the email field the first one to display, I can do it with these couple lines of code:
add_filter( ‘woocommerce_checkout_fields’, ‘email_first’ );
function email_first( $checkout_fields ) {
$checkout_fields[‘billing’][‘billing_email’][‘priority’] = 4;
return $checkout_fields;
}
First thing you have to keep in mind, that fields are separated into groups, and actually there are 4 groups:
billing — Billing Address
shipping — Shipping Address
account — Account Login
order — Additional information
Each of these groups contains fields, I think you know which ones. And you can super easily reorder them with a special priority parameter.
Just by setting the priority lower in number, as the lowest number is 10, so we made it 4 for email so it becomes the first field.
Here are the priority number list for billing fields:
billing billing_first_name 10
billing_last_name 20
billing_company 30
billing_country 40
billing_address_1 50
billing_address_2 60
billing_city 70
billing_state 80
billing_postcode 90
billing_phone 100
billing_email 110
billing — Billing Address
shipping — Shipping Address
account — Account Login
order — Additional information
Each of these groups contains fields, I think you know which ones. And you can super easily reorder them with a special priority parameter.
Just by setting the priority lower in number, as the lowest number is 10, so we made it 4 for email so it becomes the first field.
Here are the priority number list for billing fields:
billing billing_first_name 10
billing_last_name 20
billing_company 30
billing_country 40
billing_address_1 50
billing_address_2 60
billing_city 70
billing_state 80
billing_postcode 90
billing_phone 100
billing_email 110
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.