wc_get_order_status_name()
Get the nice name for an order status.
No Hooks.
Returns
String.
Usage
wc_get_order_status_name( $status );
- $status(string) (required)
- Status.
Changelog
| Since 2.2 | Introduced. |
wc_get_order_status_name() wc get order status name code WC 10.7.0
function wc_get_order_status_name( $status ) {
// "Special statuses": these are in common usage across WooCommerce, but are not normally returned by
// wc_get_order_statuses().
$special_statuses = array(
'wc-' . OrderStatus::AUTO_DRAFT => OrderStatus::AUTO_DRAFT,
'wc-' . OrderStatus::TRASH => OrderStatus::TRASH,
);
// Merge order is important. If the special statuses are ever returned by wc_get_order_statuses(), those definitions
// should take priority.
$statuses = array_merge( $special_statuses, wc_get_order_statuses() );
$unprefixed = OrderUtil::remove_status_prefix( (string) $status );
if ( ! is_string( $status ) ) {
wc_doing_it_wrong(
__FUNCTION__,
__( 'An invalid order status slug was supplied.', 'woocommerce' ),
'9.6'
);
}
return $statuses[ 'wc-' . $unprefixed ] ?? $unprefixed;
}