• Resolved BelleO

    (@belleo)


    Hello everybody! Please what code can I add to my functions.php to change the ‘Continue Shopping” text on the Cart page. We are a services site and need it to say something like ‘Explore More Services”

    Thank you in advance

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @belleo , thank you for reaching out,

    You can try using the hook: wc_add_to_cart_message_html

    I think that a code like this might help:

    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 );

    Please let me know if that code worked for you.

    Thread Starter BelleO

    (@belleo)

    Hello, thank you for your response. I added the code to functions.php but it didn’t work :(, any other ideas?

    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.

    Plugin Support Rajesh K. (woo-hc)

    (@rajeshml)

    Hello @belleo,

    Thank you for reaching out to WooCommerce Support.

    Have you tried plugins such as?Say What? or?Locotranslate? They can help you with this. You can also check more information about how translations work?here.

    For reference, this particular forum is meant for general support with the core functionality of WooCommerce itself.  It’s best to ask for insight related to this topic on either the WooCommerce Advanced Facebook group or the WooCommerce Community Slack. Many of our developers hang out there and will be able to offer insights into your question. 

    I will leave this thread open for a bit to see if anyone can chime in and help you out further.

    I wish I could help more, but hopefully, this gets you going in the right direction to get some further insight/information.

    Thanks!

    Hi there,

    I’m marking this topic as “resolved” due to recent inactivity. If more assistance is needed, feel free to post back here or open a new topic ( https://www.ads-software.com/support/plugin/woocommerce/#new-topic-0 ).

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.