enhancement: making tooltips message be selected based on order status slug. changes to get_order_status_label filter (#49812)

* enhancement: making tooltips message be selected based on order status. passes order object in woocommerce_get_order_status_labels filter for more personalized tooltips.

* Add changefile(s) from automation for the following project(s): woocommerce

* fix: change incorrect keys of order status in order_status array

* remove duplicate changelog file

* fix: linting issues

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Adrian Duffell <9312929+adrianduffell@users.noreply.github.com>
This commit is contained in:
Mino 2024-07-24 14:04:59 +01:00 committed by GitHub
parent 193f4e47bd
commit e39da623cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 10 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Tooltips message is now selected based on the order status instead of the label of the order status, which would break if the current WordPress language was not English. Also passes the order object to the woocommerce_get_order_status_labels filter to allow for more personalized tooltips.

View File

@ -1064,14 +1064,14 @@ class ListTable extends WP_List_Table {
*/
private function get_order_status_label( WC_Order $order ): string {
$status_names = array(
'Pending payment' => __( '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 customers payment failed or was declined, and no payment has been successfully made.', 'woocommerce' ),
'Draft' => __( 'Draft orders are created when customers start the checkout process while the block version of the checkout is in place.', 'woocommerce' ),
'Canceled' => __( '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 orders value after payment.', 'woocommerce' ),
'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 customers 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 orders value after payment.', 'woocommerce' ),
);
/**
@ -1081,9 +1081,9 @@ class ListTable extends WP_List_Table {
* @param WC_Order $order Current order object.
* @since 9.1.0
*/
$status_names = apply_filters( 'woocommerce_get_order_status_labels', $status_names );
$status_names = apply_filters( 'woocommerce_get_order_status_labels', $status_names, $order );
$status_name = wc_get_order_status_name( $order->get_status() );
$status_name = $order->get_status();
return isset( $status_names[ $status_name ] ) ? $status_names[ $status_name ] : '';
}