Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter fahir24

    (@fahir24)

    Dear Team,

    I have done with the following code.

    add_filter( 'woocommerce_order_get_formatted_billing_address', 'filter_admin_order_formatted_billing_address', 10, 3 );
    function filter_admin_order_formatted_billing_address( $address, $raw_address, $order ) {
        global $pagenow, $typenow; 
    
        $address .= '<br>' . $pagenow . '<br>' . $typenow;
    
        if ( ( $pagenow === 'post.php' && $typenow === 'shop_order' ) 
        || ( $pagenow === 'admin.php' && isset($_GET['page'])  && isset($_GET['action']) 
        && $_GET['page'] === 'wc-orders' && $_GET['action'] === 'edit' ) ) :
    
        $address = $raw_address['first_name'] . ' ' . $raw_address['last_name'] . '<br>';
    
        if ( isset($raw_address['company']) && $raw_address['company'] ) {
            $address .= $raw_address['company'] . '<br>';
        }
    
        if ( isset($raw_address['address_1']) && $raw_address['address_1'] ) {
            $address .= __('Street') . ': '. $raw_address['address_1'] . '<br>';
        }
    
        if ( isset($raw_address['address_2']) && $raw_address['city'] ) {
            $address .= __('Zone Number') . ': '. $raw_address['city'] . '<br>';
        }
    
        if ( isset($raw_address['postcode']) && $raw_address['postcode'] ) {
            $address .= __('Villa/Bldg Number') . ': '. $raw_address['postcode'] . '<br>';
        }
    
        $states = WC()->countries->get_states( esc_attr($raw_address['country']) );
    
        if ( isset($raw_address['state']) && isset($states[$raw_address['state']]) ) {
            $address .= $states[$raw_address['state']] . '<br>';
        }
    
        $countries = WC()->countries->get_countries();
    
        if ( isset($raw_address['country']) && isset($countries[$raw_address['country']]) ) {
            $address .= $countries[$raw_address['country']] . '<br>';
        }
    
        endif;
    
        return $address;
    }
    Thread Starter fahir24

    (@fahir24)

    Please see the attached.

Viewing 2 replies - 1 through 2 (of 2 total)