Skip to content

Instantly share code, notes, and snippets.

@vishalck
Last active August 15, 2019 09:05
Show Gist options
  • Save vishalck/3e24993a382b62920b1e81ae70f8a4b8 to your computer and use it in GitHub Desktop.
Save vishalck/3e24993a382b62920b1e81ae70f8a4b8 to your computer and use it in GitHub Desktop.
Add new column to WooCommerce Orders page
<?php
add_filter( 'manage_edit-shop_order_columns', 'MY_COLUMNS_FUNCTION' );
function MY_COLUMNS_FUNCTION( $columns ) {
$new_columns = ( is_array( $columns ) ) ? $columns : array();
unset( $new_columns[ 'order_actions' ] );
//edit this for your column(s)
//all of your columns will be added before the actions column
$new_columns['MY_COLUMN_ID_1'] = 'MY_COLUMN_1_TITLE';
$new_columns['MY_COLUMN_ID_2'] = 'MY_COLUMN_2_TITLE';
//stop editing
$new_columns[ 'order_actions' ] = $columns[ 'order_actions' ];
return $new_columns;
}
@sara5387
Copy link

Throws error now: "PHP Notice: Undefined index: order_actions" in version 3.7.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment