Last active
March 5, 2020 15:07
-
-
Save man4toman/ceca5f728b5a19c1d2e9318af066e3e9 to your computer and use it in GitHub Desktop.
WooCommerce move reorder fields checkout page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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