Skip to content

Instantly share code, notes, and snippets.

@WPprodigy
Created February 7, 2018 04:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WPprodigy/7b15029d4a06be3d86134087e4b99cbe to your computer and use it in GitHub Desktop.
Save WPprodigy/7b15029d4a06be3d86134087e4b99cbe to your computer and use it in GitHub Desktop.
Add Customer Notes column back to orders page.
<?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">&ndash;</span>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment