Last active
August 15, 2019 09:05
-
-
Save vishalck/3e24993a382b62920b1e81ae70f8a4b8 to your computer and use it in GitHub Desktop.
Add new column to WooCommerce Orders page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Throws error now: "PHP Notice: Undefined index: order_actions" in version 3.7.0.