Automattic\WooCommerce\Internal\Admin\Reports
HposLegacyOrderReportQueryBuilder::build_address_column_map
Map legacy _billing_* / _shipping_* meta keys to wc_order_addresses columns.
Under HPOS these fields live in the addresses table, not in order meta, so a meta join would return no rows for them.
Method of the class: HposLegacyOrderReportQueryBuilder{}
No Hooks.
Returns
array<string,array{0:string,1:string}>. Meta key => [address_type, column].
Usage
// private - for code of main (parent) class only $result = $this->build_address_column_map(): array;
HposLegacyOrderReportQueryBuilder::build_address_column_map() HposLegacyOrderReportQueryBuilder::build address column map code WC 11.1.2
private function build_address_column_map(): array {
$fields = array( 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode', 'country', 'email', 'phone' );
$map = array();
foreach ( array( 'billing', 'shipping' ) as $address_type ) {
foreach ( $fields as $field ) {
if ( 'shipping' === $address_type && 'email' === $field ) {
continue;
}
$map[ "_{$address_type}_{$field}" ] = array( $address_type, $field );
}
}
return $map;
}