My Account

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:

// 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.

100 WooCommerce Conversion Rate Optimisation Tips

This field is for validation purposes and should be left unchanged.

Let’s collaborate!

Need to outsource WordPress development?

Join forces with UnlimitedWP for an outsourced white label web development service you can truly rely on.

First Timer Here?

Sign up to receive 20% off on your first month with us.