Mary Mary - 2 years ago 422
PHP Question

Hide Added to Cart message on checkout page in Woocommerce

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

How can I do that?

There was a suggestion by someone (link below), but it didn't work for me.

Remove/Hide Woocommerce Added to Cart Message but Keep/Display Coupon Applied Message

Answer Source

Removing only the message (pasting it to your function.php file inside your active child theme or theme). This function will return an empty message:

// define the wc_add_to_cart_message 
function empty_wc_add_to_cart_message( $message, $product_id ) { 
    return ''; 
// add the filter 
add_filter( 'wc_add_to_cart_message', 'empty_wc_add_to_cart_message', 10, 2 );

Note: wc_add_to_cart_message replace deprecated hook woocommerce_add_to_cart_message.


CSS: Removing top message box on checkout page (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;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download