Change the WooCommerce return to shop and continue shopping URLs

You can change the WooCommerce shop URL with a filter that WooCommerce provides, this can be helpful especially if you have a one product based shop and you want your users to return to that product and not the default shop page URL.

The filter to use is aptly named – woocommerce_return_to_shop_redirect – add in your themes functions.php

add_filter( 'woocommerce_return_to_shop_redirect', 'st_woocommerce_shop_url' );
/**
 * Redirect WooCommerce Shop URL
 */

function st_woocommerce_shop_url(){

return site_url() . '/product/my-product/';

}

So in the above code the filter is run and returns the main site URL with site_url() and then adds on a slug of the page you want – above it goes to a particular product, or you could not use site_url() and just hard code the absolute URL in quotes.

A similar link is also the ‘Continue Shopping’ link which is displayed after am item has been added to the cart – its filter is woocommerce_continue_shopping_redirect – it is displayed when Redirect to the cart page after successful addition is enabled.

Woocommerce Continue Shopping

add_filter( 'woocommerce_continue_shopping_redirect', 'st_change_continue_shopping' );
/**
 * WooCommerce
 * Change continue shopping URL
 */
function st_change_continue_shopping() {
   return wc_get_page_permalink( 'shop' ); // Change link
}