How to Change Return to Shop Link in Woocommerce

Reading Time: 4 minutes
3,871 Views

Inside this article you will see a tricky concept to change return to shop link in woocommerce. This will be very interesting to see the logical and short code to do it very easily.

WooCommerce is an open-source e-commerce plugin for WordPress. It is designed for small to large-sized online merchants using WordPress.

If you are looking for an article which will give you a concept to change or update Return to Shop URL in woocommerce, you are at the right place to learn. This article contains classified information about to change url.

Learn More –

Let’s get started.


Change Return to Shop Link

After completing the WooCommerce setup one of the most common things that you will want to change or remove is the ‘Return to Shop’ link redirection.

Finding a quick solution for this problem can be difficult for WooCommerce beginners but after reading this article content you will realize that this is a very simple issue that you can solve without the need of a WooCommerce developer.

WooCommerce comes with a filter that allows users to quickly change the url of redirected page. 

You need to add this filter and it’s associated function at the end of functions.php file.

add_filter( "woocommerce_return_to_shop_redirect", "custom_empty_cart_redirect_url" );

Redirect Return to Shop Link to the Previous Page 

function custom_empty_cart_redirect_url(){
 
         return $_SERVER['HTTP_REFERER'];
}

Redirect Return to Shop Link to Home page

function custom_empty_cart_redirect_url(){
 
         return home_url();
}

Redirect Return to Shop Link to Third Party URL

function custom_empty_cart_redirect_url(){
 
         return "https://onlinewebtutorblog.com/";
}

Complete Code to Change URL

Here, is the complete code which should be added to functions.php to change the Return to Shop URL.

/**
 @snippet       Change return to shop link, send to "courses" page
 @author        Online Web Tutor
 */ 
 add_filter( 'woocommerce_return_to_shop_redirect', 'owt_change_return_shop_url' );

 function owt_change_return_shop_url() {
 
         return home_url('courses');
 }

We hope this article helped you to learn How to Change Return to Shop Link in Woocommerce Tutorial in a very detailed way.

Online Web Tutor invites you to try Skillshike! Learn CakePHP, Laravel, CodeIgniter, Node Js, MySQL, Authentication, RESTful Web Services, etc into a depth level. Master the Coding Skills to Become an Expert in PHP Web Development. So, Search your favourite course and enroll now.

If you liked this article, then please subscribe to our YouTube Channel for PHP & it’s framework, WordPress, Node Js video tutorials. You can also find us on Twitter and Facebook.