WooCommerce: How To Add Payment Method Column to Orders List

When viewing the “Orders” list in WooCommerce, we are given a set of columns detailing basic information about orders the store.

While WooCommcers offers the ability to hide columns easily via the “Screen Options” tab, adding new columns requires some custom functionality.

WooCommerce provides columns for order number and name, date of order, order status, order total, order actions and billing and shipping fields.

A handy feature to have included in your online store is a custom column for Payment Method. Whether it’s Afterpay, PayPal, Splitit, Zip, Credit Card or even Bank Transfer; if you offer multiple payment options at the checkout it’s a great idea to quickly see the payment method used for each order.

Detailing this information will save you trouble of manually viewing each order details screen and will give you an overview of what the most popular payment methods are for your online store.

To add a payment method custom column to your WooCommerce orders list, simply add the below code to your functions.php file located in your theme directory.

add_filter( 'manage_edit-shop_order_columns', 'add_payment_method_custom_column', 20 );
    function add_payment_method_custom_column( $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_payment'] = __( 'Payment Method', 'my-textdomain' );
     }
     }
     return $new_columns;
    }
    add_action( 'manage_shop_order_posts_custom_column', 'add_payment_method_custom_column_content' );
    function add_payment_method_custom_column_content( $column ) {
     global $post;
     if ( 'order_payment' === $column ) {
     $order = wc_get_order( $post->ID );
     echo $order->payment_method_title;
     }
    }

Need expert assistance with your eCommerce website? Drop me a line today on 0468 629 301 or submit an enquiry online and I’ll be in touch!

Posted on February 12, 2020 | Categories: Blog