WPSlash Licences

How to Change the “Return to Shop” Link in WooCommerce

How to Change the “Return to Shop” Link in WooCommerce – code snippet guide from WPSlash
Published
Updated
Reading time
1 minutes
Written by
WPSlash team

This snippet changes where the “Return to Shop” button on the empty cart page sends customers. By default WooCommerce points it at the shop page; the snippet points it at your homepage instead. Add it to your child theme’s functions.php file, or to a code snippets plugin.

Send the button to your homepage

Code
add_filter( 'woocommerce_return_to_shop_redirect', 'wpslash_change_return_shop_url');
function wpslash_change_return_shop_url() 
{
$url = home_url();
return $url;
}

The function hooks into woocommerce_return_to_shop_redirect and returns home_url(). To send customers somewhere else, return a different URL. For a menu page, replace home_url(); with:

Code
$url = site_url('/menu/');

Pick the page that keeps customers shopping

  • The homepage, if your shop page is not the main entry point.
  • Your restaurant menu, so an empty cart sends people back to the food.
  • A promotions or category page, if you want the click to land on something specific.

To check it worked, empty your cart and click “Return to Shop”. You should land on the page you set, not on the shop page. Test it on a staging site before you change the live shop.

FoodMaster (formerly WooFood)

For a restaurant on WooCommerce, this keeps customers on your menu instead of a generic shop page. The snippet works alongside FoodMaster (formerly WooFood), the restaurant ordering plugin for WooCommerce. You can get FoodMaster here.

FoodMasterRestaurant ordering for WooCommerce: delivery, pickup and dine-in, a POS for counter and phone orders, a kitchen display and automatic ticket printing. Used by 10,000+ restaurants.$499 for one site
All guides

FoodMaster (formerly WooFood)12 min read

Best Store Address Setup for Pickup

Compare single-address, multi-location, and directions-first pickup setups to reduce wrong-door visits and simplify checkout.

The plugins these guides are about

FoodMaster for restaurants, courier vouchers for the Greek market, marketplace sync and store tools, all for WooCommerce.

Browse plugins30-day money-back on every plugin