How to Add a WooCommerce Search Bar to Your Site Menu

Learn three ways to add a WooCommerce search bar to your site navigation menu: the no-code Advanced Woo Search plugin (v3.64+), built-in theme widgets, and a custom functions.php code snippet. Includes step-by-step instructions and a PHP example.

The search bar is one of the most used elements on any online store. Visit Amazon, eBay, Etsy or almost any large ecommerce site and you will find a search box sitting right in the header, next to the navigation menu, available on every single page. That placement is no accident: shoppers who use search are looking for a specific product and are far more likely to buy, so making the search bar easy to reach directly affects your conversions. For more on this, see why search matters for your WooCommerce shop.

By default, WooCommerce and most themes do not place a product search box inside the navigation menu. In this guide we cover three ways to add a WooCommerce search bar to your site menu, from a no-code plugin option to a custom code solution, so you can pick the approach that fits your store and your theme.

Example of search bar inside header menu
Example of search bar inside header menu
Example of search bar inside mobile menu
Example of search bar inside mobile menu

Option 1: Use Advanced Woo Search plugin

Advanced Woo Search is a popular WooCommerce search plugin that adds a fast, live AJAX search bar to your store, showing matching products as the customer types.

Starting with version 3.64, the plugin can add its search form to a navigation menu directly from the WordPress admin, with no code required.

To add the search bar to your menu:

  1. Install and activate the Advanced Woo Search plugin (version 3.64 or later).

  2. Go to Appearance → Menus in your WordPress dashboard.

  3. In the list of available menu items on the left, find the Advanced Woo Search block and select the search form you want to display.

    Menu item for Advanced Woo Search bar
    Menu item for Advanced Woo Search bar
  4. Click Add to Menu, then drag the new item to the position you want and click Save Menu.

    Advanced Woo Search bar inside menu
    Advanced Woo Search bar inside menu

Note: if you are using Advanced Woo Search PRO - additionally you can open menu item settings and choose a search form ID to show in this specific menu since the PRO plugin version allows you to create different search form instances.

Because this works through the standard WordPress menu system, you can add the search bar to whichever menus your theme supports, such as the top header menu, a secondary menu, a footer menu, or a dedicated mobile menu. The available locations depend entirely on your current theme and the menu areas it registers.

For the full walkthrough and screenshots, see the official guide on adding a search form to the navigation menu.

Option 2: Use built-in widgets

Many themes expose widget areas where you can drop a search box, and some themes register a widget area inside or near the navigation menu (often called a header or navigation widget area). Whether this option is available to you depends entirely on your current theme and which widget areas it supports. If your theme has a widget area in the header next to the menu, you can place a search widget there.

To add the built-in WooCommerce product search widget:

  1. Go to Appearance → Widgets (or Appearance → Customize → Widgets).

  2. Choose the widget area registered by your theme that sits in the header or navigation area.

    Widget area to show widgets inside top header area
    Widget area to show widgets inside top header area
  3. Add the Product Search widget (the WooCommerce search block) to that area.

    Product Search widget inside header widget area
    Product Search widget inside header widget area
  4. Save your changes and check the front end to confirm the search bar appears where you want it.

As an additional option, Advanced Woo Search ships with its own search widget, so you can place the AJAX-powered search form into any widget area the same way. This gives you live results instead of the default WooCommerce search.

Advanced Woo Search built-in widget
Advanced Woo Search built-in widget

For a step-by-step setup, see our guide on adding a custom WooCommerce search widget.

Option 3: Use custom code solution

If your theme does not include a search form in its menu and has no suitable widget area, you can inject one with a small code snippet. This option is aimed at more advanced users who are comfortable making some code changes. With this approach you can output either the default WooCommerce search form or the Advanced Woo Search form.

Let's look at a search snippet that adds a search bar as the last item for the main_navigation menu location.

add_filter( 'wp_nav_menu_items', 'my_wp_nav_menu', 10, 2 );

function my_wp_nav_menu( $items, $args ) {
    if ( isset( $args->theme_location ) && 'main_navigation' === $args->theme_location && function_exists( 'get_product_search_form' ) ) {
        $items .= '<li class="menu-item menu-item-search">' . get_product_search_form( false ) . '</li>';
    }

    return $items;
}

Change 'main_navigation' to match your theme's menu location identifier. To target every menu, remove the theme_location condition.

If you are using the Advanced Woo Search plugin - you can use the following code to programmatically add the plugin search bar inside a menu item.

add_filter( 'wp_nav_menu', 'my_wp_nav_menu', 10, 2 );
function my_wp_nav_menu( $nav_menu, $args ) {
    if ( $args->theme_location === 'main_navigation' ) {
        $aws_form = aws_get_search_form( false );
        $nav_menu = str_replace( '</ul>', '<li class="menu-item">' . $aws_form . '</li></ul>', $nav_menu );
    }
    return $nav_menu;
}

FAQs

How do I add a search bar to my WordPress menu without code?

The easiest no-code way is the Advanced Woo Search plugin (version 3.64 or later). Go to Appearance → Menus, find the Advanced Woo Search item in the list of available blocks, select the form you want, and click Add to Menu. See the step-by-step guide for details.

Can I add the search bar to a mobile menu?

Yes, as long as your theme registers a separate menu location for mobile. Because the search bar is added as a standard menu item, it appears in whichever menu you assign it to, whether that is the top header, a secondary menu, the footer, or a dedicated mobile menu. The available locations depend on your current theme.

My theme has no search option in its menu, what can I do?

You have two main options. Use a plugin like Advanced Woo Search that adds the form as a menu item directly, or add a small snippet to your theme's functions.php that hooks into the wp_nav_menu filter and injects the search form. The custom-code approach is covered in the navigation menu guide.

Can I use the default WooCommerce search form instead of a plugin?

Yes. The built-in Product Search widget and WooCommerce's get_product_search_form() function both output the standard search box, which you can place in a widget area or inject with code. A plugin like Advanced Woo Search adds live AJAX results and the ability to search by SKU and attributes, which the default form does not provide.

Can I add the search bar to more than one menu?

Yes. You can add the search form to several menus at once, for example a main header menu and a separate mobile menu. With the plugin method, just add the Advanced Woo Search item to each menu under Appearance → Menus. With custom code, remove the theme_location condition from the snippet so the form is appended to every menu.

Conclusion

Putting a search bar in your site menu helps shoppers find products from any page, just like they expect in a modern online store.

The easiest option is to use Advanced Woo Search, which lets you add a search bar as a menu item without writing any code.

If your theme includes a header widget area, the default WooCommerce search widget may be enough. And if you want more control, you can use a small code snippet to place the search form exactly where you need it. Choose the method that fits your theme and experience level, and make product search faster and easier for your customers.

For Advanced Woo Search
Michael Barinov

Michael Barinov

I'm Michael — the developer behind KramaKit. I've spent 12+ years building tools for WooCommerce, trusted by 80,000+ stores. I work alone on purpose: it keeps things focused, and if you've ever emailed support, you've talked to me.

← Previous Advanced Woo Labels: What’s New in Versions 2.37-2.46

Leave a comment

Take a look around. Or just say hi.

Browse the full plugin lineup, or send a question - we read every message and reply personally.