×

 

Home Contact Us Payments SC Commerce SC Commerce Docs SC Commerce Snippets

Simply Computing

We make websites. Simple.

Redirect main shop page

The main shop page is often not a useful view when you have hundreds of products. You can redirect this page to another url or even to a 404 (page not found) if you want to disable that viewing option.

IMPORTANT NOTE: This snippet may interfere with the Product Search widget. The search results page will also be redirected to the new url.

		/**
 * Redirect WooCommerce main shop page
 */

add_action('template_redirect', 'sc_woo_shop_page_redirect');

function sc_woo_shop_page_redirect() {

  if(is_shop()) {
    wp_redirect(home_url('/404/'));
    exit();    
  }

}
	
   View Raw Code ID: 91049