Automattic\WooCommerce\Internal\Fulfillments
FulfillmentUtils::get_order_fulfillment_status_text
Get the fulfillment status text for an order.
Method of the class: FulfillmentUtils{}
Hooks from the method
Returns
String. The fulfillment status text.
Usage
$result = FulfillmentUtils::get_order_fulfillment_status_text( $order ): string;
- $order(WC_Order) (required)
- The order object.
FulfillmentUtils::get_order_fulfillment_status_text() FulfillmentUtils::get order fulfillment status text code WC 10.3.3
public static function get_order_fulfillment_status_text( WC_Order $order ): string {
// Ensure the order is a valid WC_Order object.
if ( ! $order instanceof WC_Order ) {
return '';
}
// Check if the order meta exists for fulfillment status.
$fulfillment_status = self::get_order_fulfillment_status( $order );
$fulfillment_status_text = '';
switch ( $fulfillment_status ) {
case 'fulfilled':
$fulfillment_status_text = ' ' . __( 'It has been <mark class="fulfillment-status">Fulfilled</mark>.', 'woocommerce' );
break;
case 'partially_fulfilled':
$fulfillment_status_text = ' ' . __( 'It has been <mark class="fulfillment-status">Partially fulfilled</mark>.', 'woocommerce' );
break;
case 'unfulfilled':
$fulfillment_status_text = ' ' . __( 'It is currently <mark class="fulfillment-status">Unfulfilled</mark>.', 'woocommerce' );
break;
case 'no_fulfillments':
$fulfillment_status_text = ' ' . __( 'It has <mark class="fulfillment-status">no fulfillments</mark> yet.', 'woocommerce' );
break;
}
/**
* This filter allows plugins to modify the fulfillment status text for an order for their custom fulfillment statuses.
*
* @since 10.1.0
*
* @param string $fulfillment_status_text The default fulfillment status text.
* @param string $fulfillment_status The fulfillment status of the order.
* @param WC_Order $order The order object.
*/
return apply_filters(
'woocommerce_fulfillment_order_fulfillment_status_text',
$fulfillment_status_text,
$fulfillment_status,
$order
);
}