Skip to content

Instantly share code, notes, and snippets.

@man4toman
Last active March 5, 2020 15:07
Show Gist options
  • Save man4toman/ceca5f728b5a19c1d2e9318af066e3e9 to your computer and use it in GitHub Desktop.
Save man4toman/ceca5f728b5a19c1d2e9318af066e3e9 to your computer and use it in GitHub Desktop.
WooCommerce move reorder fields checkout page
<?php
add_filter( 'woocommerce_default_address_fields', 'wc_reorder_fields_checkout_page' );
function wc_reorder_fields_checkout_page( $fields ) {
// default priorities:
// 'first_name' – 10
// 'last_name' – 20
// 'company' – 30
// 'country' – 40
// 'address_1' – 50
// 'address_2' – 60
// 'city' – 70
// 'state' – 80
// 'postcode' – 90
// e.g. move 'company' above 'first_name':
// just assign priority less than 10
$fields['state']['priority'] = 70;
return $fields;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment