WooCommerce Code Reference

WC_Admin_Notices
in package
Uses AccessiblePrivateMethods

WC_Admin_Notices Class.

Table of Contents

$core_notices  : array<string|int, mixed>
Array of notices - name => callback.
$notices  : array<string|int, mixed>
Stores notices.
add_custom_notice()  : mixed
Add a custom notice.
add_maxmind_missing_license_key_notice()  : mixed
Add MaxMind missing license key notice.
add_min_version_notice()  : mixed
Add notice about minimum PHP and WordPress requirement.
add_notice()  : mixed
Show a notice.
add_notices()  : mixed
Add notices + styles if needed.
add_redirect_download_method_notice()  : mixed
Add notice about Redirect-only download method, nudging user to switch to a different method instead.
base_tables_missing_notice()  : mixed
Notice about base tables missing.
download_directories_sync_complete()  : mixed
Notice about the completion of the product downloads sync, with further advice for the site operator.
get_notices()  : array<string|int, mixed>
Get notices
has_notice()  : bool
See if a notice is being shown.
hide_notices()  : mixed
Hide a notice if the GET variable is set.
init()  : mixed
Constructor.
install_notice()  : mixed
If we have just installed, show a message with the install pages button.
legacy_shipping_notice()  : mixed
Show a notice asking users to convert to shipping zones.
maxmind_missing_license_key_notice()  : mixed
Display MaxMind missing license key notice.
no_shipping_methods_notice()  : mixed
No shipping methods.
output_custom_notices()  : mixed
Output any stored custom notices.
prepare_note_with_nonce()  : object
Parses query to create nonces when available.
redirect_download_method_notice()  : mixed
Notice about Redirect-Only download method.
regenerating_lookup_table_notice()  : mixed
Notice shown when regenerating thumbnails background process is running.
regenerating_thumbnails_notice()  : mixed
Notice shown when regenerating thumbnails background process is running.
remove_all_notices()  : mixed
Remove all notices.
remove_notice()  : mixed
Remove a notice from being displayed.
reset_admin_notices()  : mixed
Reset notices for themes when switched or a new version of WC is installed.
secure_connection_notice()  : mixed
Notice about secure connection.
simplify_commerce_notice()  : mixed
Simplify Commerce is no longer in core.
store_notices()  : mixed
Store notices to DB
template_file_check_notice()  : mixed
Show a notice highlighting bad template files.
theme_check_notice()  : mixed
Show the Theme Check notice.
update_notice()  : mixed
If we need to update the database, include a message with the DB update button.
uploads_directory_is_unprotected_notice()  : mixed
Notice about uploads directory begin unprotected.
wp_php_min_requirements_notice()  : void
Notice about WordPress and PHP minimum requirements.
is_plugin_active()  : bool
Wrapper for is_plugin_active.
is_ssl()  : bool
Determine if the store is running SSL.
is_uploads_directory_protected()  : bool
Check if uploads directory is protected.
hide_notice()  : mixed
Hide a single notice.
maybe_add_php74_required_notice()  : mixed
Add an admin notice about the bump of the required PHP version in WooCommerce 8.2 if the current PHP version is too old.
maybe_remove_php74_required_notice()  : mixed
Remove the admin notice about the bump of the required PHP version in WooCommerce 8.2 if the current PHP version is good.

Properties

$core_notices

Array of notices - name => callback.

private static array<string|int, mixed> $core_notices = array('update' => 'update_notice', 'template_files' => 'template_file_check_notice', 'legacy_shipping' => 'legacy_shipping_notice', 'no_shipping_methods' => 'no_shipping_methods_notice', 'regenerating_thumbnails' => 'regenerating_thumbnails_notice', 'regenerating_lookup_table' => 'regenerating_lookup_table_notice', 'no_secure_connection' => 'secure_connection_notice', WC_PHP_MIN_REQUIREMENTS_NOTICE => 'wp_php_min_requirements_notice', 'maxmind_license_key' => 'maxmind_missing_license_key_notice', 'redirect_download_method' => 'redirect_download_method_notice', 'uploads_directory_is_unprotected' => 'uploads_directory_is_unprotected_notice', 'base_tables_missing' => 'base_tables_missing_notice', 'download_directories_sync_complete' => 'download_directories_sync_complete')

Methods

add_custom_notice()

Add a custom notice.

public static add_custom_notice(string $name, string $notice_html) : mixed
Parameters
$name : string

Notice name.

$notice_html : string

Notice HTML.

Return values
mixed

add_maxmind_missing_license_key_notice()

Add MaxMind missing license key notice.

public static add_maxmind_missing_license_key_notice() : mixed
Tags
since
3.9.0
Return values
mixed

add_min_version_notice()

Add notice about minimum PHP and WordPress requirement.

public static add_min_version_notice() : mixed
Tags
since
3.6.5
Return values
mixed

add_notice()

Show a notice.

public static add_notice(string $name[, bool $force_save = false ]) : mixed
Parameters
$name : string

Notice name.

$force_save : bool = false

Force saving inside this method instead of at the 'shutdown'.

Return values
mixed

add_redirect_download_method_notice()

Add notice about Redirect-only download method, nudging user to switch to a different method instead.

public static add_redirect_download_method_notice() : mixed
Return values
mixed

download_directories_sync_complete()

Notice about the completion of the product downloads sync, with further advice for the site operator.

public static download_directories_sync_complete() : mixed
Return values
mixed

install_notice()

If we have just installed, show a message with the install pages button.

public static install_notice() : mixed
Tags
deprecated
4.6.0
Return values
mixed

legacy_shipping_notice()

Show a notice asking users to convert to shipping zones.

public static legacy_shipping_notice() : mixed
Tags
todo

remove in 4.0.0

Return values
mixed

maxmind_missing_license_key_notice()

Display MaxMind missing license key notice.

public static maxmind_missing_license_key_notice() : mixed
Tags
since
3.9.0
Return values
mixed

prepare_note_with_nonce()

Parses query to create nonces when available.

public static prepare_note_with_nonce(object $response) : object
Parameters
$response : object

The WP_REST_Response we're working with.

Tags
deprecated
5.4.0
Return values
object$response The prepared WP_REST_Response object.

redirect_download_method_notice()

Notice about Redirect-Only download method.

public static redirect_download_method_notice() : mixed
Tags
since
4.0
Return values
mixed

regenerating_lookup_table_notice()

Notice shown when regenerating thumbnails background process is running.

public static regenerating_lookup_table_notice() : mixed
Tags
since
3.6.0
Return values
mixed

regenerating_thumbnails_notice()

Notice shown when regenerating thumbnails background process is running.

public static regenerating_thumbnails_notice() : mixed
Return values
mixed

remove_notice()

Remove a notice from being displayed.

public static remove_notice(string $name[, bool $force_save = false ]) : mixed
Parameters
$name : string

Notice name.

$force_save : bool = false

Force saving inside this method instead of at the 'shutdown'.

Return values
mixed

reset_admin_notices()

Reset notices for themes when switched or a new version of WC is installed.

public static reset_admin_notices() : mixed
Return values
mixed

simplify_commerce_notice()

Simplify Commerce is no longer in core.

public static simplify_commerce_notice() : mixed
Tags
deprecated
3.6.0

No longer shown.

Return values
mixed

theme_check_notice()

Show the Theme Check notice.

public static theme_check_notice() : mixed
Tags
deprecated
3.3.0

No longer shown.

Return values
mixed

update_notice()

If we need to update the database, include a message with the DB update button.

public static update_notice() : mixed
Return values
mixed

uploads_directory_is_unprotected_notice()

Notice about uploads directory begin unprotected.

public static uploads_directory_is_unprotected_notice() : mixed
Tags
since
4.2.0
Return values
mixed

wp_php_min_requirements_notice()

Notice about WordPress and PHP minimum requirements.

public static wp_php_min_requirements_notice() : void
Tags
since
3.6.5
Return values
void

is_plugin_active()

Wrapper for is_plugin_active.

protected static is_plugin_active(string $plugin) : bool
Parameters
$plugin : string

Plugin to check.

Return values
bool

is_uploads_directory_protected()

Check if uploads directory is protected.

protected static is_uploads_directory_protected() : bool
Tags
since
4.2.0
Return values
bool

maybe_add_php74_required_notice()

Add an admin notice about the bump of the required PHP version in WooCommerce 8.2 if the current PHP version is too old.

private static maybe_add_php74_required_notice() : mixed

TODO: Remove this method in WooCommerce 8.2.

Return values
mixed

maybe_remove_php74_required_notice()

Remove the admin notice about the bump of the required PHP version in WooCommerce 8.2 if the current PHP version is good.

private static maybe_remove_php74_required_notice() : mixed

TODO: Remove this method in WooCommerce 8.2.

Return values
mixed