wc_get_order_status_name()
Get the nice name for an order status.
Хуков нет.
Возвращает
Строку.
Использование
wc_get_order_status_name( $status );
- $status(строка) (обязательный)
- Status.
Список изменений
| С версии 2.2 | Введена. |
Код wc_get_order_status_name() wc get order status name WC 10.4.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;
}