Skip to content

How to Search WooCommerce Products by Category in WordPress?

Key Takeaways

  • Nexter Blocks Search Bar block lets WordPress users search WooCommerce products by category after selecting Taxonomy in Source and Product categories in the Select Taxonomy dropdown.
  • Search Bar block adds a dropdown beside the search bar, with Label and Placeholder fields plus All Result and Show Count toggles.
  • AJAX Search in the Extra Option tab lets shoppers select a product category from the dropdown or search for products within that category.
Table of Contents

A store with a few hundred products needs more than a text box. Letting a shopper pick the category first turns a vague search into a specific one.

The Search Bar builds the dropdown from your real product categories.

For every Search Bar setting in one place, see the Search Bar guide.

Before You Start

  • Edition: Free. Measured with Nexter Blocks Pro deactivated, the Search Bar renders identically — form, input, dropdowns, suggestions and results all work without Pro.
  • Block to enable: Search Bar, switched on under Nexter > Blocks in your WordPress dashboard.
  • WooCommerce active, with published products. Product search is guarded: with WooCommerce inactive the block returns an error rather than an empty list.
  • Products assigned to product categories. The dropdown is built from those terms.

Steps

  1. Select your Search Bar block and add a filter field with taxonomy as its source.
Adding a taxonomy filter field
  1. Choose Product Category as the taxonomy, then publish.
Choosing the product category taxonomy

How It Behaves

  • The dropdown is built from your live product categories. Measured on a store with five, the dropdown rendered 6 options including the All entry.
  • Choosing a category filters the query exactly. Measured: selecting the Prints category returned exactly 6 products, matching that category’s real contents.
  • The post type is derived from the taxonomy, so choosing product category is enough to make it a product search — you do not also need a post type filter.
  • Hidden products stay hidden, because the catalogue visibility exclusion still applies.
  • Prices render on the cards once the price toggle is on, using WooCommerce’s own markup.

Limitations

  • Only top-level product categories are listed unless sub-categories are enabled, and sub-term indenting is only implemented for the built-in category taxonomy.
  • Empty categories still appear and return nothing when chosen.
  • One category at a time. There is no multi-select.
  • The category narrows, it does not search. The typed term still has to match an enabled field, which by default is the product title only.

Troubleshooting

The dropdown is empty

No product categories exist, or the taxonomy was not selected on the filter field.

Choosing a category returns nothing

Either nothing is assigned to it, or the typed term does not match the titles of the products that are.

It is returning blog posts as well

That happens when a separate post type filter is also present and set wider. Remove it and let the taxonomy decide.

Related Docs

Share your Thoughts

Still in Doubt? Let’s Assist You

Have Feedback or Questions?

Join our WordPress Community on Facebook!