Automattic\WooCommerce\Internal\Admin\Notes

MerchantEmailNotifications::get_merchant_preferred_name()public staticWC 1.0

Get the preferred name for user. First choice is the user's first name, and then display_name.

{} Это метод класса: MerchantEmailNotifications{}

Хуков нет.

Возвращает

Строку. User's name.

Использование

$result = MerchantEmailNotifications::get_merchant_preferred_name( $user );
$user(WP_User) (обязательный)
Recipient to send the note to.

Код MerchantEmailNotifications::get_merchant_preferred_name() WC 7.1.0

public static function get_merchant_preferred_name( $user ) {
	$first_name = get_user_meta( $user->ID, 'first_name', true );
	if ( $first_name ) {
		return $first_name;
	}
	if ( $user->display_name ) {
		return $user->display_name;
	}
	return '';
}