Automattic\WooCommerce\Utilities

OrderUtil::get_post_or_object_meta()public staticWC 1.0

Gets value of a meta key from WC_Data object if passed, otherwise from the post object. This helper function support backward compatibility for meta box functions, when moving from posts based store to custom tables.

Метод класса: OrderUtil{}

Хуков нет.

Возвращает

Массив|Разное|Строку. Value of the meta key.

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

$result = OrderUtil::get_post_or_object_meta( ?WP_Post $post, ?\WC_Data $data, $key, $single );
?WP_Post $post (обязательный)
-
?\WC_Data $data (обязательный)
-
$key(строка) (обязательный)
Key to fetch metadata for.
$single(true|false) (обязательный)
Whether metadata is single.

Код OrderUtil::get_post_or_object_meta() WC 8.7.0

public static function get_post_or_object_meta( ?WP_Post $post, ?\WC_Data $data, string $key, bool $single ) {
	return wc_get_container()->get( COTMigrationUtil::class )->get_post_or_object_meta( $post, $data, $key, $single );
}