Change the redirection of the WooCommerce “back to store” button

Hello guys,

You have asked me how you can make the button that appears in the cart "Return to the store" when it is empty, instead of going to the store it goes to the home or any other personalized url.

In this video we will see how we have to do:

Subscribe to my channel:  

As you can see we only have to add the following function in the functions.php file of our template:

/**
 * Changes the redirect URL for the Return To Shop button in the cart.
 *
 * @return string
 */
function wc_empty_cart_redirect_url() {
	return 'http://miweb.com';
}
add_filter( 'woocommerce_return_to_shop_redirect', 'wc_empty_cart_redirect_url' );

Remember to do it in a child theme so you don't lose it when updating the template.

Any doubt here you have me.

Greetings 😉
Oscar

6 comments on “Change the redirection of the WooCommerce “return to store” button”

  1. I want to do something similar to what you put in the video, but in this case I would like when I enter a product, a little higher up I see Home / Men's clothing / shirts, for example.
    Well, I have the Divi theme and I have created a page with the store module. When I am inside the product and click on men's clothing, it redirects me to the default category page of woocommerce, but I want it to go to the page that I have created with the store module.

    Do you have any solution.

    Thank you.

  2. Thank you very much Oscar!! It has served me! Thanks for the input! Greetings!!

Leave a comment