Refers to FiboSearch Pro only

Search in custom fields

​What’s the use of searching in custom fields?

More often than not it is important to allow your clients to search according to additional data you’ve added to your products. The most common cases are searching by EAN, UPC, ISBN, serial numbers – there are too many to mention. Usually, those attributes are added using some sort of custom fields, preferably plugin-aided. The most popular is, of course, ACF – Advanced Custom Fields, with more than 2+ mil active installations. Other notable and generally acclaimed plugins include Custom Product Tabs for WooCommerce, WooCommerce Custom Fields and any others designed for adding custom fields.

Where to find this option?

FiboSearch makes it easy for you to make those custom fields searchable from our search bar. To allow the option, head to WooCommerceFiboSearchSearch config.

Overall design and workflow

We assume that you’re familiar with custom fields – if not, please consider our article on FiboSearch/ACF integration as a starting point. We want to present you the full potential of searchable custom fields based on our mockup store, The Bookstore Online. Let’s assume that someone wants to search for a book and knows its particular ISBN – a unique number identyfying every edition of a book, magazine, etc. ISBN are standardized and nowadays consist of 13 digits. Let’s see what happens when we type the first 3 digits into the search bar:

As you can see, right now the search engine returns a no-result query. Fortunately, we’d configured our custom ISBN field, using the ACF plugin, and then added it to some products. Now, let’s head to WooCommerce Search config, and allow our custom fields to be searchable. Just pick the relevant fields from a dropdown list – and it’s done!

Remember to always save changes → and wait for the indexer to rebuild.

Now, our store can be searched by ISBNs:

Notice¹: In the dropdown list you’ll see custom fields found in the postmeta table, under the meta_key key, in your database. The list contains the exact same keys that are present in the database. The exceptions are custom integrations. In such cases keys might be replaced with more readable labels.

Notice²: On the GIF above you can see that the searched ISBN is presented alongside the autosuggestion — in fact, this is possible for any given custom field.  This feature has to be activated. To do so, please visit this link and learn how to enable it.

Integrations

FiboSearch has been integrated with every custom fields-related plugin. We are tightly integrated with ACF and Custom Product Tabs for WooCommerce plugins. For more information please refer to the Technical details section.

It’s important to note that:

  1. for integration with the ACF plugin – fields will have an [ACF] prefix
  2. for integration with the Custom Product Tabs for WooCommerce plugin – fields will have a [Custom Product Tabs For WooCommerce] prefix

An example from our mockup store:

Geek-only details

Here, we have some precious details for those of you with profound knowledge and always hungry for more:

  • As there is no reason to search by some custom fields, they are automatically excluded from the list; e.g. it is pointless to search by thumbnail_id field, which is only an ID of the miniature assigned to the product; more excluded fields meet following rules:
  • If, for whatever reason, the field is not present in the dropdown list, you can add it manually using this filter:
add_filter('dgwt/wcas/indexer/searchable_custom_fields', function($custom_fields) {
   $custom_fields[] = array(
      'label' => 'My custom field',
      'key'   => 'my_custom_field'
   );
   
   return $custom_fields;
});