How to Redirect WooCommerce Shop URL to another page

How To Redirect WooCommerce Shop URL To Another Page

How to Redirect WooCommerce Shop URL to another page

In this tutorial, we are going to show you how to redirect the WooCommerce shop URL to another page.

Why might you want to redirect the WooCommerce URL? There is a handful of reasons why you might want to do this. A few being if you have a website that has a single WooCommerce product, you might want to redirect the shop to that single product page. Another option might be you have created a custom landing page for your WooCommerce shop and you would like to redirect to that instead.

Redirect WooCommerce Shop URL

In order to redirect the WooCommerce shop URL, you need to add the following code into your themes functions.php file.

// Redirect WooCommerce Shop URL
function wpc_shop_url_redirect() {
    if( is_shop() ){
        wp_redirect( home_url( '/custom-page/' ) ); // Assign custom internal page here
add_action( 'template_redirect', 'wpc_shop_url_redirect' );

In the above code, when the function is run it returns the home URL with home_url() and then adds on a slug of the page you want – For this example we have the WooCommerce shop URL being redirected to a custom page slug. If you wish to redirect to the home URL you can just leave the home_url() bracket empty or leave a ‘/’.

In Summary

Obviously, there are a lot of benefits to the new lazy load feature, however, if you ever need to disable it now you have the knowledge and know-how to do so.

Need Help with your Website?

Our Experts can handle any customization or developement at a reasonable price.

Get a Quote

Looking for more?

Here are some other articles that we think you will be interested in!