Change default woocommerce “has been added to your cart” with the product name-title

Well, it’s quite a simple fix but I had a hard time finding it so here you go, I’ll share it with you. If you want to change the default Woocommerce “[Product Title] has been added to your cart” message, you need to add this bunch of code in your theme functions.php:

add_filter( 'wc_add_to_cart_message', 'custom_wc_add_to_cart_message', 10, 2 ); 
 
 function custom_wc_add_to_cart_message( $message, $product_id ) { 

 $message = sprintf( '%s has been added to your selection.', get_the_title( $product_id ) ); 

 return $message; 

 }

Leave a Reply

Your email address will not be published.