地址字段由WC_Countries
类,并可通过以下方式进行过滤:
$address_fields = apply_filters( \'woocommerce_\' . $type . \'fields\', $address_fields, $country );
其中有2种$类型:计费和发货。一旦发现这只是PHP数组操作:
function reorder_shipping_fields( $address_fields ){
if ( isset( $address_fields[\'shipping_company\'] ) ){
$shipping_company = $address_fields[\'shipping_company\'];
unset( $address_fields[\'shipping_company\'] );
$address_fields[\'shipping_company\'] = $shipping_company;
}
return $address_fields;
}
add_filter( \'woocommerce_shipping_fields\', \'reorder_shipping_fields\' );