Add the shipping rate to your WooCommerce order column

function order_shipping_column_header( $columns ) {

    $new_columns = array();

    foreach ( $columns as $column_name => $column_info ) {

        $new_columns[ $column_name ] = $column_info;

        if ( 'order_total' === $column_name ) {
            $new_columns['order_details'] = __( 'Shipping cost', 'woocommerce' );
        }
    }

    return $new_columns;
}
add_filter( 'manage_edit-shop_order_columns', 'order_shipping_column_header', 20);

add_action( 'manage_shop_order_posts_custom_column', 'order_admin_shipping_column_content' );
 
function order_admin_shipping_column_content( $column ) {
   
    global $post;
 
    if ( 'order_details' === $column ) {
 
        $order = wc_get_order( $post->ID );
		
		foreach ($order->get_items('shipping') as $item_id => $shipping) 
            {   
                $method_id = $shipping->get_method_id();
                $name      = $shipping->get_name();
                $total     = $shipping->get_total();
            }
       echo wc_price( $total, array( 'currency' => $currency ) );
    }
}

The results would be as follows:

This code can be added following the instructions here:

How to add custom code to your WooCommerce/WordPress site the right way

Have any feedback? Be sure to let me know here: Contact me

Share your thoughts

Your email address will not be published. Required fields are marked *