Hide Woocommerce message added to cart

I want to remove the "xx-product added to your cart message from the top of my checkout page.

How can i do this?

There was someone's suggestion (link below), but this did not work for me.

Delete / Hide Woocommerce Added to basket message, but save / show coupon application message

+8
source share
2 answers

Update for Woocommerce 3+

The wc_add_to_cart_message hook has wc_add_to_cart_message deprecated and replaced with wc_add_to_cart_message_html . You can use the following (compact efficient way):

 add_filter( 'wc_add_to_cart_message_html', '__return_false' ); 

Or in the normal way:

 add_filter( 'wc_add_to_cart_message_html', 'empty_wc_add_to_cart_message'); function empty_wc_add_to_cart_message( $message, $products ) { return ''; }; 

Before Woocommerce 3, use this:

Delete only the message (insert it into the function.php file inside the active child topic or theme). This function will return an empty message:

 add_filter( 'wc_add_to_cart_message', 'empty_wc_add_to_cart_message', 10, 2 ); function empty_wc_add_to_cart_message( $message, $product_id ) { return ''; }; 

The code is placed in the function.php file of your active child theme (or active theme).

Note: wc_add_to_cart_message replaces the deprecated woocommerce_add_to_cart_message hook.

(UPDATED)

CSS: removing the top message box on the style.css design style.css (add this css rule to the style.css file located inside your active child theme or theme):

 .woocommerce-checkout .woocommerce .woocommerce-message { display:none !important; } 
+15
source

my first option worked

add_filter ('wc_add_to_cart_message_html', '__return_false');

on this page https://alpha-herb.com/special-offer-free-sample-and-hypnosis-session/

thanks Loic!

0
source

All Articles