mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-30 11:42:22 +08:00
https://stackoverflow.com/questions/71146561/woocommerce-address1-and-address2-display-on-one-line
24 lines
971 B
Text
24 lines
971 B
Text
function change_order_formatted_billing_address( $address, $WC_Order ) {
|
|
|
|
$current_screen = get_current_screen();
|
|
|
|
if( $current_screen == 'shop_order' && isset( $_GET['action'] ) && $_GET['action'] == 'edit' ){
|
|
|
|
$address = array(
|
|
'first_name' => $WC_Order->billing_first_name,
|
|
'last_name' => $WC_Order->billing_last_name,
|
|
'vat' => $WC_Order->billing_vat,
|
|
'company' => $WC_Order->billing_company,
|
|
'address_1' => $WC_Order->billing_address_1.' '.$WC_Order->billing_address_2,
|
|
'city' => $WC_Order->billing_city,
|
|
'state' => $WC_Order->billing_state,
|
|
'postcode' => $WC_Order->billing_postcode,
|
|
'country' => $WC_Order->billing_country
|
|
);
|
|
}
|
|
|
|
return $address;
|
|
|
|
}
|
|
|
|
add_filter( 'woocommerce_order_formatted_billing_address' , 'change_order_formatted_billing_address', 10, 2 );
|