Automattic\WooCommerce\Internal\Admin\Orders

ListTable::get_order_status_label()privateWC 1.0

Gets the order status label for an order.

Method of the class: ListTable{}

Hooks from the method

Return

String.

Usage

// private - for code of main (parent) class only
$result = $this->get_order_status_label( $order ): string;
$order(WC_Order) (required)
The order object.

ListTable::get_order_status_label() code WC 9.3.3

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 ] : '';
}