Automattic\WooCommerce\Blocks\Domain\Services

Hydration::store_notice_functions_available │ protected │ WC 11.1.0

Whether the store notice functions (wc_get_notices(), wc_clear_notices(), wc_set_notices()) are available to call.

These three functions share a single definition site in includes/wc-notice-functions.php, which WooCommerce loads only for frontend/REST requests (or via wc_load_cart()). On a plain wp-admin load the functions may therefore be absent even when a WooCommerce session exists, so this seam must be checked independently of the session guard. It is protected so tests can override it to force the unavailable branch deterministically.

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

Хуков нет.

Возвращает

bool. True if the notice functions are defined and safe to call.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->store_notice_functions_available(): bool;

Список изменений

С версии 11.1.0 Введена.

Код Hydration::store_notice_functions_available() WC 11.2.2

protected function store_notice_functions_available(): bool {
	return function_exists( 'wc_set_notices' );
}