Home / Admin / wpadmin add phone number with address in orders page
Duplicate Snippet

Embed Snippet on Your Site

wpadmin add phone number with address in orders page

Code Preview
php
<?php
add_action( 'manage_shop_order_posts_custom_column' , 'custom_orders_list_column_content', 50, 2 );
function custom_orders_list_column_content( $column, $post_id ) {
	global $the_order, $post;
    if ( $column == 'shipping_address' )
    {
        if( $phone = $the_order->get_billing_phone() ){
            $phone_wp_dashicon = '<span class="dashicons dashicons-phone"></span> ';
            echo '<br><a href="tel:'.$phone.'">'. $phone.'</a></strong>';
        }
    }
	if ( 'order_status' === $column ) {
                
        // Start list
        echo '<ul class="orders-list-items-preview">';
        
        // Loop through order items
        foreach ( $the_order->get_items() as $item ) {
            $product      = $item->get_product();
            $product_name = $item->get_name();
            $product_qty  = $item->get_quantity();
            echo "<li><label>$product_qty</label> $product_name</li>";
        }
        
        // End list
        echo '</ul>';
    }
}

Comments

Add a Comment