Automattic\WooCommerce\Blocks\Domain\Services
Hydration::store_notice_functions_available
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.
Method of the class: Hydration{}
No Hooks.
Returns
bool. True if the notice functions are defined and safe to call.
Usage
// protected - for code of main (parent) or child class $result = $this->store_notice_functions_available(): bool;
Changelog
| Since 11.1.0 | Introduced. |
Hydration::store_notice_functions_available() Hydration::store notice functions available code WC 11.1.2
protected function store_notice_functions_available(): bool {
return function_exists( 'wc_set_notices' );
}