• Resolved caleb1

    (@caleb1)


    Is there a way to change where the woocommerce shop links redirect to. Such as the “return to shop” link in the empty cart and anywhere else there might be a link to the shop page. I want to use my own separate custom page as the main location of displaying my products and it would be great to change any links to the shop to redirect there instead of the woocommerce shop page.
    I tried making a redirect in cpanel to redirect “/shop” to my custom page, but that didnt work. It seems to me like that only works when you are giving it a directory to redirect. Must not work for the wordpress system.

    Thanks for any help or input on this.

Viewing 4 replies - 1 through 4 (of 4 total)
  • hello @caleb1 You can use put the below code into your function.php and I hope it will slove your problem

    function custom_shop_page_redirect() {
        if( is_shop() ){
            wp_redirect( home_url( '/product-category/coffee/' ) );//Enter your another page URL here.
            exit();
        }
    }
    add_action( 'template_redirect', 'custom_shop_page_redirect' );
    • This reply was modified 5 years, 1 month ago by Mohit Mishra.
    Thread Starter caleb1

    (@caleb1)

    Thanks for the reply. Do you think you might be able to provide me with some more detail as to what function.php file you are referring to.

    There are multiple files I found that filenames ended in “functions.php” under the woo commerce folder but I am not sure which one to add this to.

    Thanks.

    Hello @caleb1 you can add this code in the functions.php file of the currently activated theme.for this go to wp-content/themes/your current activated theme/functions.php

    Thread Starter caleb1

    (@caleb1)

    That worked!
    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Changing shop links’ is closed to new replies.