1

Is there any way to redirect WooCommerce default 'http://website.com/shop/' URL to 'http://website.com/shop/all/'?

After a long research found this : How does Wordpress redirect to WooCommerce shop page? but not works as i expect

So you Have any idea?

1

You can use woocommerce_return_to_shop_redirect filter to overwrite the redirection url.

add_filter( 'woocommerce_return_to_shop_redirect', "custom_woocommerce_return_to_shop_redirect" ,20 );
function custom_woocommerce_return_to_shop_redirect(){
   return site_url()."shop/all/";
}
1

@Swarnendu Paul answer is great, I'd just replace site_url().'shop/all' with home_url('/shop/all') in case the home url and site url are not the same :)

so, it'd be:

add_filter( 'woocommerce_return_to_shop_redirect', "custom_woocommerce_return_to_shop_redirect" ,20 ); 
function custom_woocommerce_return_to_shop_redirect(){
    return home_url('shop/all/');
}
-1

for 2017 try:

function custom_shop_page_redirect() {
    if( is_shop() ){
        wp_redirect( home_url( '/shop/all/' ) );
        exit();
    }
}
add_action( 'template_redirect', 'custom_shop_page_redirect' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.