Support » Plugin: WooCommerce » Shop link navigate directly to category? – part II

  • Resolved teuptworkshop

    (@teuptworkshop)


    I would like the “shop” link to directly take customers to one of my product subcategories that I specified. I was offered a solution here:

    https://wordpress.org/support/topic/shop-link-navigate-directly-to-category/

    This worked:

    function custom_shop_page_redirect() {
        if( is_shop() ){
            wp_redirect( home_url( '/product-category/coffee/' ) );
            exit();
        }
    }
    add_action( 'template_redirect', 'custom_shop_page_redirect' );

    However, I just found out that this solution breaks the search function, or at least when using Advanced Woo Search (not sure about the default search). Whenever I search for something, it will keep redirecting to that category that I specified in the functions.php modification.

    Perhaps there’s a better solution that does not affect search behaviour?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support EastOfWest

    (@eastofwest)

    Hi there,

    In your original thread the question was this:

    Is it possible that when customers click the link to the shop from the top bar in Storefront, to haev it navigate directly to a particular category of products?

    Just to clarify, because perhaps I’m missing something – are you referring to the link to your shop page from your site’s menu bar?

    If that is the case, have you tried replacing the default menu item with a custom menu item, calling it “Shop” and updating the link to point at your category instead?

    Thread Starter teuptworkshop

    (@teuptworkshop)

    Thanks for your reply. I’m not sure what is what to be honest – I noticed there’s a “menu” feature but it seems to be separate from the bar at the top of the page that links to all of the pages? That bar seems to be generated based on the pages I make and their settings… but I don’t know how to edit it directly…

    Plugin Support kellymetal

    (@kellymetal)

    Hi there,

    If you open your Customizer (under Appearance > Customize from your wp-admin dashboard), then go to the “Menus” tab, you can select your menu and edit it from there.

    You can add/remove menu items there. If you click “Add Item”, it will present you many different options, including a “Product Categories” section. From there you can add a link to your product category:

    Customizer Menu
    Link to image: https://d.pr/i/chgwPH

    After that, you can rename that item/link to “Shop”.

    There’s lots of info about working with menus available here:
    https://wordpress.com/support/menus/

    I hope that helps!

    Thread Starter teuptworkshop

    (@teuptworkshop)

    Hello, thanks for your reply. I hadn’t used that menu section at all yet, I wasn’t aware I could create one and it would replace the default one this way. That’s great! Thanks for explaining, it works great & good to know how this menu thing works, as it will probably help me to improve the mobile version too.

    Plugin Support kellymetal

    (@kellymetal)

    Hi there,

    Very glad to hear that information was helpful! : )

    Yes, being able to customize your menu the way you want can definitely make it easier for your customers to find what they are looking for.

    I’m going to mark this thread as resolved. If you have any further questions, please start a new thread.

    Have a wonderful day!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Shop link navigate directly to category? – part II’ is closed to new replies.