Wes Asbell
Wes Asbell

Reputation: 283

Woocommerce Change Continue Shopping Button

I am trying to change the "Continue Shopping" button in the "added to cart" message section of a Woocommerce cart page to say "Proceed to Checkout" and also link to the checkout page (/checkout).

There seem to be plenty of plugins and info about changing the link, but I'm having trouble changing both the link and what the button says.

Any help would be greatly appreciated.

Upvotes: 1

Views: 9702

Answers (2)

Pitchpole
Pitchpole

Reputation: 11

I spent hours trying to get this add_filter hook to work and it just didn't. No matter how I wrote the code it had no effect.

After an incredible waste of time I finally came across the simplest solution. woocomerce -> settings -> products

Change the "shop page" to whatever page it is you want people to go to after clicking the continue shopping button. In my case it was the home page. Problem solved. No functions.php required.

Upvotes: 0

Ben Spi
Ben Spi

Reputation: 806

I am not the greatest coder in history, but try to add this to you functions.php

add_filter( 'woocommerce_continue_shopping_redirect', 'my_changed_woocommerce_continue_shopping_redirect', 10, 1 );
function my_changed_woocommerce_continue_shopping_redirect( $return_to ){

    $return_to = wc_get_page_permalink( 'checkout' );

    return $return_to;
}


add_filter( 'wc_add_to_cart_message_html', 'my_changed_wc_add_to_cart_message_html', 10, 2 );
function my_changed_wc_add_to_cart_message_html($message, $products){

    if (strpos($message, 'Continue shopping') !== false) {
        $message = str_replace("Continue shopping", "Go the checkout", $message);
    }

    return $message;

}

Upvotes: 6

Related Questions