Black Friday & Cyber Monday SUPER SALE ALL WEEK:
Grab 40% OFF on plugins
Days
Hours
Minutes
Seconds

How to Remove Order ID columns from ‘My Account’> Orders in WooCommerce?

Certain businesses might prefer to use alternative tracking or reference numbers internally, and displaying the default order IDs to customers could cause confusion or disrupt their internal processes. In such cases, you might require such customization to hide order ID columns from the orders table of My Account. Let’s look further at how this WooCommerce customization will enhance the user experience on their My Account page!

Solution: Remove Order ID columns from ‘My Account’> Orders in WooCommerce

The code snippet removes the default “Order Number” (order-number) columns displayed in the “My Account” >Orders section of WooCommerce.

function ts_wc_add_my_account_orders_column( $columns ) {
    $new_columns = array();
    foreach ( $columns as $key => $name ) {
        if( 'order-number' === $key || 'order-total' === $key ) {
            // Skip these columns
            continue;
        }
        // Add other columns to the new array
        $new_columns[ $key ] = $name;
    }
    

    return $new_columns;
}

add_filter( 'woocommerce_my_account_my_orders_columns', 'ts_wc_add_my_account_orders_column' );

Output

The default orders table is modified by removing the Orders column that usually contains the order IDs of the orders.

How to Remove Order ID columns from 'My Account'> Orders in WooCommerce? - Tyche Softwares

While the need to remove default order IDs may arise only in rare scenarios, most of the time, store owners might be looking to add prefixes or suffixes to order numbers. This customization adds valuable context to your order IDs, making order management more intuitive and efficient.

Browse more in: Code Snippets, WooCommerce How Tos, WooCommerce Tutorials

Share It:

Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x