Call Us Now at +1.403.536.9877 or fire us an email for a free quote

Change default woocommerce "has been added to your cart" with the product name/title

Posted by Bruno
on 16 November 2016

Well it's quite a simple fix but I had 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 your comments

Post comment as a guest

0 / 2000 Character restriction
Your text should be in between 20-2000 characters
terms and condition.
  • No comments found