When adding or removing a product to or from the cart in WooCommerce, a message appears under the header letting the the user know the action has been successful. These messages are known as cart notices in WooCommerce. Depending on the theme, these notices can sometimes be quite annoying and are sometimes just not needed. Instincts tell us to click in the top right hand corner of the screen where the cart icon is when a product has been added. A lot of the time, the menu cart notification bubble will tell a user if a product has been added successfully or not. This guide shows you how to remove both the ‘product added to cart’ as well as the ‘product removed from cart, undo?’ cart notices.
/**
* Snippet Name: WooCommerce remove cart notices
* Snippet Aurthor: ecommercehints.com
*/
// Remove "added to cart" notice
add_filter( 'wc_add_to_cart_message_html', '__return_false' );
// Remove "product was removed. Undo?" notice
add_filter('woocommerce_cart_item_removed_notice_type', '__return_false');