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:

functions.php
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.

  1. WooCommerce icon WooCommerce7+ million installs apply_filters( 'woocommerce_notice_types', array( 'error', 'success', 'notice' ) ) includes/wc-notice-functions.php:157
  2. FunnelKit icon FunnelKit30,000+ installs apply_filters( 'woocommerce_notice_types', array( 'error', 'success', 'notice' ) ) modules/checkouts/includes/class-wfacp-ajax-controller.php:432
  3. Payfast Gateway for WooCommerce icon Payfast Gateway for WooCommerce2,000+ installs apply_filters( 'woocommerce_notice_types', array('error', 'success', 'notice') ) classes/WC_Gateway_PayGate.php:410
  4. PVT icon PVT1,000+ installs apply_filters( 'woocommerce_notice_types', array( 'error', 'success', 'notice' ) ) inc/frontend/class_pvtfw_cart.php:249
  5. STAGGS icon STAGGS400+ installs apply_filters( 'woocommerce_notice_types', array( 'error', 'success', 'notice' ) ) includes/woocommerce/class-staggs-cart.php:54
  6. Awesome for WC icon Awesome for WC10+ installs apply_filters( 'woocommerce_notice_types', ['error', 'success', 'notice'] ) components/stWcCouponCode/includes/ajax-manager.php:22
  7. Instant Shop for WooCommerce icon Instant Shop for WooCommerce10+ installs apply_filters( 'woocommerce_notice_types', array( 'error', 'success', 'notice' ) ) public/class-instant-shop-for-woocommerce-shop.php:88
  8. IPS Cart&Checkout for WooCommerce icon 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.