str_replace
is case sensitive, so if the text you see is: “Continue Shopping”, you should replace “Continue shopping” with “Continue Shopping”.
function custom_continue_shopping_button_text( $message, $products, $show_qty ) {
// Replace 'Continue shopping' with your custom text
$custom_text = 'Explore More Services';
// Replace the existing 'Continue Shopping' text in the message
$message = str_replace( 'Continue Shopping', $custom_text, $message );
return $message;
}
add_filter( 'wc_add_to_cart_message_html', 'custom_continue_shopping_button_text', 10, 3 );
Just to check, you’re adding the code snippet in the functions.php
file that your active theme is using, right?
That code adds a filter to wc_add_to_cart_message_html and replaces the text we will show there; however, a plugin or theme could also be using that hook, preventing our changes from happening.