Created
February 7, 2018 04:02
-
-
Save WPprodigy/7b15029d4a06be3d86134087e4b99cbe to your computer and use it in GitHub Desktop.
Add Customer Notes column back to orders page.
This file contains hidden or 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_shop_order_posts_columns', 'wc_define_columns', 15 ); | |
function wc_define_columns( $columns ) { | |
$columns['customer_notes'] = __( 'Customer Notes', 'woocommerce' ); | |
return $columns; | |
} | |
add_action( 'manage_shop_order_posts_custom_column', 'wc_render_customer_notes_column', 10, 2 ); | |
function wc_render_customer_notes_column( $column, $post_id ) { | |
if ( 'customer_notes' !== $column ) { | |
return; | |
} | |
$order = wc_get_order( $post_id ); | |
if ( $order && $order->get_customer_note() ) { | |
echo '<span class="note-on tips" data-tip="' . wc_sanitize_tooltip( $order->get_customer_note() ) . '">' . __( 'Yes', 'woocommerce' ) . '</span>'; | |
} else { | |
echo '<span class="na">–</span>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment