Since 9.13/9.14 update, the hover behaviour when hovering over the order status in the order list has changed. Previously, the order notes were displayed but now only a description of the status displays. This old functionality was very useful in keeping track of comms with clients without needing to open the order itself. Please give us an option to display the order note as in the previous version.
Open
Last updated: August 5, 2024
Log in to comment on this feature request.
Good afternoon, everyone!
I used a solution from another version of woocommerce 8.3.1 and it works as before!
Find the ListOrders.php file at the path: …/wp-content/plugins/woocommerce/src/Internal/Admin/Orders/ListTable.php
Then simply replace the function
‘public function render_order_status_column( WC_Order $order )’
Modified function from version 8.3.1:
public function render_order_status_column( WC_Order $order ): void {
$tooltip = ”;
remove_filter( ‘comments_clauses’, array( ‘WC_Comments’, ‘exclude_order_comments’ ), 10, 1 );
$comment_count = get_comment_count( $order->get_id() );
add_filter( ‘comments_clauses’, array( ‘WC_Comments’, ‘exclude_order_comments’ ), 10, 1 );
$approved_comments_count = absint( $comment_count[‘approved’] );
if ( $approved_comments_count ) {
$latest_notes = wc_get_order_notes(
array(
‘order_id’ => $order->get_id(),
‘limit’ => 1,
‘orderby’ => ‘date_created_gmt’,
)
);
$latest_note = current( $latest_notes );
if ( isset( $latest_note->content ) && 1 === $approved_comments_count ) {
$tooltip = wc_sanitize_tooltip( $latest_note->content );
} elseif ( isset( $latest_note->content ) ) {
/* translators: %d: notes count */
$tooltip = wc_sanitize_tooltip( $latest_note->content . ” . sprintf( _n( ‘Plus %d other note’, ‘Plus %d other notes’, ( $approved_comments_count – 1 ), ‘woocommerce’ ), $approved_comments_count – 1 ) . ” );
} else {
/* translators: %d: notes count */
$tooltip = wc_sanitize_tooltip( sprintf( _n( ‘%d note’, ‘%d notes’, $approved_comments_count, ‘woocommerce’ ), $approved_comments_count ) );
}
}
// Gracefully handle legacy statuses.
if ( in_array( $order->get_status(), array( ‘trash’, ‘draft’, ‘auto-draft’ ), true ) ) {
$status_name = ( get_post_status_object( $order->get_status() ) )->label;
} else {
$status_name = wc_get_order_status_name( $order->get_status() );
}
if ( $tooltip ) {
printf( ‘%s’, esc_attr( sanitize_html_class( ‘status-‘ . $order->get_status() ) ), wp_kses_post( $tooltip ), esc_html( $status_name ) );
} else {
printf( ‘%s’, esc_attr( sanitize_html_class( ‘status-‘ . $order->get_status() ) ), esc_html( $status_name ) );
}
}
/**
* Gets the order status label for an order.
*
* @param WC_Order $order The order object.
*
* @return string
*/
private function get_order_status_label( WC_Order $order ): string {
$status_names = array(
‘pending’ => __( ‘The order has been received, but no payment has been made. Pending payment orders are generally awaiting customer action.’, ‘woocommerce’ ),
‘on-hold’ => __( ‘The order is awaiting payment confirmation. Stock is reduced, but you need to confirm payment.’, ‘woocommerce’ ),
‘processing’ => __( ‘Payment has been received (paid), and the stock has been reduced. The order is awaiting fulfillment.’, ‘woocommerce’ ),
‘completed’ => __( ‘Order fulfilled and complete.’, ‘woocommerce’ ),
‘failed’ => __( ‘The customer’s payment failed or was declined, and no payment has been successfully made.’, ‘woocommerce’ ),
‘checkout-draft’ => __( ‘Draft orders are created when customers start the checkout process while the block version of the checkout is in place.’, ‘woocommerce’ ),
‘cancelled’ => __( ‘The order was canceled by an admin or the customer.’, ‘woocommerce’ ),
‘refunded’ => __( ‘Orders are automatically put in the Refunded status when an admin or shop manager has fully refunded the order’s value after payment.’, ‘woocommerce’ ),
);
/**
* Provides an opportunity to modify and extend the order status labels.
*
* @param array $action Order actions.
* @param WC_Order $order Current order object.
* @since 9.1.0
*/
$status_names = apply_filters( ‘woocommerce_get_order_status_labels’, $status_names, $order );
$status_name = $order->get_status();
return isset( $status_names[ $status_name ] ) ? $status_names[ $status_name ] : ”;
}
/**
* Renders order billing information.
*
* @param WC_Order $order The order object for the current row.
*
* @return void
*/
public function render_billing_address_column( WC_Order $order ): void {
$address = $order->get_formatted_billing_address();
if ( $address ) {
echo esc_html( preg_replace( ‘##i’, ‘, ‘, $address ) );
if ( $order->get_payment_method() ) {
/* translators: %s: payment method */
echo ” . sprintf( esc_html__( ‘via %s’, ‘woocommerce’ ), esc_html( $order->get_payment_method_title() ) ) . ”;
}
} else {
echo ‘–’;
}
}
I hope that I can help someone!
We are so much less efficient without this feature!! Would love to see it fixed!!