This simple snippet will make sure you can send users back to a custom page as opposed to the shop page when the Cart is empty. In this particular project, client had no shop page so we wanted to send users back to the homepage instead.

As usual, it’s a couple of lines of PHP, without the need to override templates or even worse to edit core WooCommerce. Enjoy!

WooCommerce: edit return to shop link

PHP snippet: Change “Return to Shop” Button Link – WooCommerce

 * @snippet       Change return to shop link, send to homepage instead
 * @how-to        Get FREE
 * @sourcecode
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 3.5.6
 * @donate $9

add_filter( 'woocommerce_return_to_shop_redirect', 'bbloomer_change_return_shop_url' );

function bbloomer_change_return_shop_url() {
return home_url();

Leave a Reply