Refers only to FiboSearch Pro

Show custom taxonomy terms in autocomplete

FiboSearch displays not only matching products in autocomplete but also “non-products” objects like product categories, tags, and brands if you have a compatible plugin. What, if you want to show matching terms from custom taxonomy, e.g. brands, some attributes, books authors, artists, and so on. You can do it using custom snippets.

Table of Contents

We present 3 examples, which cover different use cases.

[Example 1] Show “Books Authors” in an autocomplete (custom taxonomy)

This example is about an online bookstore, where books are products and authors are custom taxonomy. Assume that the name of custom taxonomy is “book_author“. After following the steps below, users will show matching book authors (custom taxonomy terms) in an autocomplete.

Step 1 – Register your custom taxonomy in FiboSearch

Add the following snippet to your functions.php file or use e.g. Code Snippet plugin. Replace book_author with your real taxonomy name.

add_filter( 'dgwt/wcas/indexer/taxonomies', function ( $taxonomies ) {
	$taxonomies[] = 'book_author';

	return $taxonomies;
} );

Step 2 – Turn on “Show authors” in the FiboSearch settings

Go to WooCommerce -> FiboSearch -> Autocomplete (tab). The new checkbox called “Show authors” should appear under the section “Non-products in autocomplete”. Check it and save the settings.

Step 3 – Rebuild the search index

After saving the settings, the search index should start rebuilding automatically. Go to WooCommerce -> FiboSearch -> Indexer (tab), observe the status and wait for finishing.

Step 4 – Let’s see if it works

Check if terms from your custom taxonomy show up in an autocomplete. The results should look like this:


[Example 2] Show “Case Pack Size” (product attribute) in an autocomplete

Attributes in WooCommerce are custom taxonomies, so FiboSearch Pro also can show them in an autocomplete. This case is the same as the one described in Case 1. All you have to do is replacing book_author with the taxonomy name of the attribute, you want to add to the search.

Step 1 – Find taxonomy name

A taxonomy name of an attribute has the form pa_{attribute_name}. In our case, we have an attribute with slug case-pack-size. It means that the taxonomy name is pa_case-pack-size.

Alternatively, you can check the URL address when you are on attribute listing in the WordPress dashboard. Go to WooCommerce -> Attributes and go to a specific attribute view. Take a look at the URL address.

Step 2 – Make sure your attribute has enabled archives

Go to Products -> Attributes and click “Edit” below the attribute want to add to the search. Make sure you have checked the checkbox “Enable archives?”.


Step 3 – Follow the steps from the Example 1

The next steps are the same as in Example 1. The results should look like this:

Support for images

If you need support for images, see our other tutorial “How to search for brands?“. This tutorial describes how to integrate your custom brand solutions where the brand is a custom taxonomy. So it’s a very similar example to those described in this article and you can follow the steps. Remember to replace product_brand to your custom taxonomy name.