WooCommerce Show Order Weight Column In My Account Orders Table

WooCommerce My Account Orders table showing custom column with order weight


There are no pre-requisites in order for you to be able to implement this solution.

How To Implement This Solution?

Simply copy the pre-coded solution to your active theme’s functions.php or preferably the Code Snippets Plugin.

About this Solution

This snippet inserts a new, custom column in the table of orders shown in My Account > Orders populated with the total weight of the order so the customer is aware how heavy their order was.

Specifically, this snippet has two blocks of code. The first block inserts the column. In this example, we have inserted this column between the Order Total and Order Actions column. This can be changed by changing the column key in the code. Your custom will appear after the column key you define.

The second block of code is where the magic happens. It first loops through each item in the order and gets it weight and times this by the quantity of this product. It then adds this weight of each product to a variable we have called $total_weight. The total weight is then output to the new column followed by the weight unit you have defined in your store settings under WordPress Dashboard > WooCommerce > Settings > Products > General > Measurements > Weight Unit.

 * Snippet Name:	WooCommerce Show Order Weight Column In My Account Order View Table
 * Snippet Author:	ecommercehints.com

// First, create the new table column between Total and Actions columns
add_filter( 'woocommerce_my_account_my_orders_columns', 'ecommercehints_weight_column_my_account_orders_table', 10, 1 );
function ecommercehints_weight_column_my_account_orders_table( $columns ) {
    $weight_column = [];
    foreach ( $columns as $key => $name ) {
        $weight_column[ $key ] = $name;
        if ( 'order-total' === $key ) {	// Insert new column after Total column
            $weight_column['order-items'] = __( 'Order Weight', 'woocommerce' );
    return $weight_column;

// Second, insert the data from the order into the new column
add_action( 'woocommerce_my_account_my_orders_column_order-items', 'ecommercehints_get_order_weight', 10, 1 );
function ecommercehints_get_order_weight( $order ) {
	$weight_unit = get_option('woocommerce_weight_unit');
	$total_weight = 0;
	foreach( $order->get_items() as $item_id => $item ){
		$quantity = $item->get_quantity();
        $product = $item->get_product();
        $product_weight = $product->get_weight(); 
        $total_weight += floatval( $product_weight * $quantity );
    echo $total_weight . $weight_unit;

Snippet Benefits

  • Show the total order weight in the customer’s My Account Orders table.
WooCommerce Conversion Rate Optimisation (CRO) eBook
100 WooCommerce Conversion Rate Optimisation Tips

Leave a Reply

If you are going to write code in the comments, please wrap it between code tags.

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

Other Recent Guides

Subscribe To Emails

Get exclusive WooCommerce tips that I only share with email subscribers

Join hundreds of other subscribers