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
        exit();
    }
}
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.

Table of Contents

Looking for more?

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

Screenshot of the Elementor page builder interface, with a drag-and-drop sidebar on the left and a web page preview on the right. A logo sits centerstage, set against a pink and purple gradient—perfect for adding PHP Code to Elementor projects.

How To Add PHP Code to Elementor

In this tutorial, we are going to show you how to easily add PHP Code to any Elementor page by creating a simple shortcode and adding it to your functions.php

Screenshot showing a webpage with food listings and a pop-up form titled Listing Settings, where a restaurant listing is being edited. Three food-related cards are visible, displayed in a layout created with WPBakery Visual Composer.

Create A WPBakery Visual Composer Add-On

Learn how easy it is to create a WPBakery Visual Composer Add-on element that you can use for almost any application! This can come in handy when you’re building a website for a client that isn’t so tech savy, but would like to be able to make some changes on their own in the future. Click the link to get started: