I have a custom column in the WooCoomerce admin order list that displays customer notes.
I only want to show the notes in the order list if the order is in a specific custom status wc-autoquote
.
Is this possible to filter this out for all other order statuses?
Code for my custom column:
add_filter('manage_edit-shop_order_columns', 'add_customer_note_column_header');
function add_customer_note_column_header($columns) {
$new_columns = (is_array($columns)) ? $columns : array();
$new_columns['order_customer_note'] = 'Customer Notes';
return $new_columns;
}
add_action('admin_print_styles', 'add_customer_note_column_style');
function add_customer_note_column_style() {
$css = '.widefat .column-order_customer_note { width: 15%; }';
wp_add_inline_style('woocommerce_admin_styles', $css);
}
add_action('manage_shop_order_posts_custom_column', 'add_customer_note_column_content');
function add_customer_note_column_content($column) {
global $post, $the_order;
if(empty($the_order) || $the_order->get_id() != $post->ID) {
$the_order = wc_get_order($post->ID);
}
$customer_note = $the_order->get_customer_note();
if($column == 'order_customer_note') {
echo('<span class="order-customer-note">' . $customer_note . '</span>');
}