Change the WooCommerce Shop Page URL

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_filter( 'woocommerce_return_to_shop_redirect', 'st_woocommerce_shop_url' ); 
function st_woocommerce_shop_url(){  	
return site_url() . '/product-category/sales/';  

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.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.