If you want to change the WooCommerce added to cart notice, you need a filter that hooks on wc_add_to_cart_message_html to change the default added to cart message to a custom notice.
This message or notice appears when you add a product to cart and it is displayed at the top of the page as shown on the image below :
In the previous tutorial, I shared with you how to remove this WooCommerce added to cart notice if you do not want your visitors to see it. You can check out the post here – how to remove added to your cart WooCommerce notice.
Change Added to Cart Notice in WooCommerce
To change this notice to a custom message you need to open the functions.php file and add the code snippet below :
/** * Custom Added to your Cart Message */ add_filter( 'wc_add_to_cart_message_html', 'njengah_custom_added_to_cart_message' ); function njengah_custom_added_to_cart_message() { $message = 'You cool product is in the cart!' ; return $message; }
You can edit the message variable in the code to reflect your custom message that you wish to replace the default cart message.This code can be added to funtions.php or a custom plugin and the result will be as shown on the image below :
Comments are closed.