Home » WooCommerce: Change “Return to Shop” URL

WooCommerce: Change “Return to Shop” URL

by Tutor Aspire

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-change-return-shop-url
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 tutoraspire.com FREE
 * @author        Tutor Aspire
 * @compatible    WooCommerce 6
 * @donate $9     https://www.tutoraspire.com
 */

add_filter( 'woocommerce_return_to_shop_redirect', 'tutoraspire_change_return_shop_url' );

function tutoraspire_change_return_shop_url() {
   return home_url();
}

You may also like