• Resolved fahir24

    (@fahir24)


    How to show labels for WooCommerce default fields in admin Order Detail Page.

    • This topic was modified 8 months ago by fahir24.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support jmatiasmastro

    (@jmatiasmastro)

    @fahir24 Hi mate, give clicking on the pencil icon (Edit) a try to view the field labels.

    Best regards, QuadLayers Support Team.

    Thread Starter fahir24

    (@fahir24)

    Please see the attached.

    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;
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show labels for WooCommerce default fields in admin Order Detail page’ is closed to new replies.