Home » WooCommerce: Remove / Edit “Added to Your Cart” Message

WooCommerce: Remove / Edit “Added to Your Cart” Message

by Tutor Aspire

A client asked me to completely remove the message that appears after you add a product to the cart from the product page. This is simply done by using a PHP snippet, so here’s the quick fix for you!

woocommerce-remove-was-successfully-added-to-cart-message
How to remove the “Added to your Cart” message in WooCommerce

PHP Snippet #1: Remove “X has been added to your cart” Message

/**
* @snippet       Remove "added to your cart" message
* @how-to        Get tutoraspire.com FREE
* @author        Tutor Aspire
* @compatible    WooCommerce 5
* @donate $9     https://www.tutoraspire.com
*/

add_filter( 'wc_add_to_cart_message_html', '__return_null' );

PHP Snippet #2: Edit “has been added to your cart” Message

/**
* @snippet       Edit "has been added to your cart" message
* @how-to        Get tutoraspire.com FREE
* @author        Tutor Aspire
* @compatible    WC 5
* @donate $9     https://www.tutoraspire.com
*/

add_filter( 'wc_add_to_cart_message_html', 'tutoraspire_custom_add_to_cart_message' );

function tutoraspire_custom_add_to_cart_message() {
   $message = 'Nicely done!' ;
   return $message;
}

You may also like