Hello Team,
We are trying to reorder checkout fields in WooCommerce so that Pin Code appears before City.
Currently:
* billing\_city → priority 70
* billing\_postcode → priority 80
We tried using the following snippet with woocommerce_checkout_fields
, but it did not take effect:
php
add_filter( 'woocommerce_checkout_fields', 'reorder_checkout_fields', 99 );
function reorder_checkout_fields( $fields ) {
$fields['billing']['billing_postcode']['priority'] = 65;
$fields['billing']['billing_city']['priority'] = 70;
return $fields;
}
We also tested with caching disabled and cart fragments excluded.
To force the order, we are now using woocommerce_default_address_fields
:
php
add_filter( 'woocommerce_default_address_fields', 'force_address_field_order', 999 );
function force_address_field_order( $fields ) {
$fields['postcode']['priority'] = 65;
$fields['city']['priority'] = 70;
return $fields;
}
Can you please confirm if this is the correct and recommended way to ensure Pin Code always appears before City across checkout and account address forms?
Thank you.