WordPress filter hook
woocommerce_notice_types
Defined by WooCommerce and fired by 8 plugins in total, running on 7M+ sites between them.
“(Ignore this hook. It is a standard WooCommerce hook.) phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound”
How to use woocommerce_notice_types
It's a filter: your callback receives the value, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'woocommerce_notice_types', function( $value ) {
// Change $value here.
return $value;
}, 10, 1 );Argument names come from WooCommerce's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
8 plugins that fire woocommerce_notice_types
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
WooCommerce7+ million installs
apply_filters( 'woocommerce_notice_types', array( 'error', 'success', 'notice' ) )includes/wc-notice-functions.php:157 -
FunnelKit30,000+ installs
apply_filters( 'woocommerce_notice_types', array( 'error', 'success', 'notice' ) )modules/checkouts/includes/class-wfacp-ajax-controller.php:432 -
Payfast Gateway for WooCommerce2,000+ installs
apply_filters( 'woocommerce_notice_types', array('error', 'success', 'notice') )classes/WC_Gateway_PayGate.php:410 -
PVT1,000+ installs
apply_filters( 'woocommerce_notice_types', array( 'error', 'success', 'notice' ) )inc/frontend/class_pvtfw_cart.php:249 -
STAGGS400+ installs
apply_filters( 'woocommerce_notice_types', array( 'error', 'success', 'notice' ) )includes/woocommerce/class-staggs-cart.php:54 -
Awesome for WC10+ installs
apply_filters( 'woocommerce_notice_types', ['error', 'success', 'notice'] )components/stWcCouponCode/includes/ajax-manager.php:22 -
Instant Shop for WooCommerce10+ installs
apply_filters( 'woocommerce_notice_types', array( 'error', 'success', 'notice' ) )public/class-instant-shop-for-woocommerce-shop.php:88 -
IPS Cart&Checkout for WooCommerceFewer than 10 installs
apply_filters( 'woocommerce_notice_types', array( 'error', 'success', 'notice' ) )includes/classes/Utilities/Sidecart/SC_ManageData.php:918
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.