GET FREE VERSION GET THE PRO VERSION

How to Create WooCommerce Search Results Filters Based on ACF Fields

Overview

Advanced Custom Fields (ACF) is one of the most popular WordPress plugins used by developers to add custom fields to posts, pages, and products. Its flexibility and ease of use have made it a go-to tool for tailoring WordPress sites to specific needs.

As WooCommerce stores grow and product catalogs expand, store owners face an increasing demand for more refined and precise search capabilities. Default WooCommerce search is limited, often returning too many or irrelevant results. That's where we can use acf filters and advanced custom fields filters to limit search results only to needed products and make users' search queries more relevant.

In this article, we’ll show you how to create WooCommerce search results filters based on ACF fields using both custom code and the Advanced Woo Search plugin.

As an example, we will create a is_searchable boolean ACF field and show in product search results only products with that field value set to 1.

Products search results before applying ACF filters

Products search results before applying ACF filters

Products search results after applying ACF filters

Products search results after applying ACF filters

Why Use ACF for WooCommerce Filtering

Out of the box, the WooCommerce search results page returns all products that match the current search query.

Default WooCommerce products search results

Default WooCommerce products search results

But what if you need to limit those search results by a specific parameter?

This is where ACF comes in. With ACF, you can attach custom fields to WooCommerce products - whether it’s text fields, dropdowns, checkboxes, or even repeaters. These custom fields open the door to acf woocommerce filters and advanced custom fields search filters that truly reflect your store’s unique catalog.

Real-world use cases include:

  • Filtering clothing by color and size
  • Searching electronics by brand or technical specs
  • Browsing furniture by material or collection

Ways to Filter Search Results by ACF Fields

To enable filtering by ACF fields, there are two main approaches:

  • Writing custom code
  • Using the Advanced Woo Search (AWS) plugin

Advanced Woo Search plugin is a powerful tool that allows you to enhance WooCommerce search with support for ACF, custom taxonomies, product metadata, and more - all without writing code.

Advanced Woo Search
The best search solution for your WooCommerce store.

In this article, we’ll cover both ways of limiting search results by ACF fields and compare them in the end.

Filtering Search Results by ACF Fields with Custom Code

First, let's cover how to filter search results by an ACF field using a custom code snippet.

Example: Filter by is_searchable field created via ACF plugin.

ACF field is_searchable

ACF field is_searchable

To implement this logic, use the following code snippet:

add_action('pre_get_posts', 'filter_woocommerce_search_by_custom_field');
function filter_woocommerce_search_by_custom_field($query) {
    if (!is_admin() && $query->is_main_query() && $query->is_search() && is_woocommerce()) {

        $meta_query = array(
            array(
                'key'     => 'is_searchable',
                'value'   => '1',
                'compare' => '='
            )
        );

        $query->set('meta_query', $meta_query);
    }
}

Add this code somewhere outside the plugins folder, for example, inside the functions.php file of your theme, or use a plugin for adding code snippets.

This approach works but has limitations. What if you need to add additional logic, like another ACF field or a different comparison operator? Or what if you want to apply this rule only for certain customer groups? Adding all those parameters will quickly make the code large and unreadable.

It also requires coding knowledge and lacks a user-friendly interface. For most store owners, a plugin solution is far more efficient and flexible.

Filtering Search Results by ACF Fields with AWS Plugin

For almost anyone, the simplest yet most powerful way to create search result filters based on an ACF field is to use the Advanced Woo Search plugin.

The Advanced Woo Search plugin makes it simple to set up acf search filters without any coding. Here’s how you can do it:

  1. Install and activate the AWS plugin.
  2. Reindex the plugin table by clicking the Reindex table button inside the settings page. This action only needs to be done once.

    Reindex Table button

    Reindex Table button

  3. Go to Adv. Woo Search -> Search Results page in your WordPress dashboard. Scroll down to the Filter Results section.

    Filter Results section

    Filter Results section

  4. Click on the Filter products search results button to create a new filter for product search results.

    Filters for products search results

    Filters for products search results

  5. Set the following new search results filter:
    ACF:Fields -> is searchable -> equal to -> 1

    Search results filtering rule based on ACF field value

    Search results filtering rule based on ACF field value

  6. Now just save all your changes and check the search results - they will now only show products where the ACF field is_searchable is set to 1.

This setup lets customers refine results using acf filter by custom field, creating a much more powerful and intuitive shopping experience.

Bonus: Filtering Search Results by ACF Taxonomy with AWS Plugin

If you’re using ACF to create custom taxonomies (like “Collection”, “Theme”, or “Designer”), AWS can handle that too.

Example: Filtering by "Collection" taxonomy created via ACF plugin

  1. In ACF, create a custom taxonomy called Collection and assign it to products.

    Collection taxonomy inside ACF settings page

    Collection taxonomy inside ACF settings page

  2. Go to Products -> Collection taxonomy page and add some new terms for it like “Spring 2025”, “Luxury Line”, or “Eco Series”.

    Collection taxonomy terms

    Collection taxonomy terms

  3. Go to Adv. Woo Search -> Search Results page in your WordPress dashboard. Scroll down to the Filter Results section.

    Filter Results section

    Filter Results section

  4. Click on the Filter products search results button to create a new filter for product search results.

    Filters for products search results

    Filters for products search results

  5. Set the following new search results filter:
    Product taxonomy -> Collection -> equal to -> {taxonomy term}
    where {taxonomy term} is the desired Collection taxonomy term. Or set it to Any to show all products that have any term related to the Collection taxonomy.

    Search results filtering rule based on ACF field value

    Search results filtering rule based on ACF field value

  6. Save the options and check your search results - you will now see only WooCommerce product search results that have the required Collection taxonomy terms.

    Search results with filter by Collection taxonomy

    Search results with filter by Collection taxonomy

Now, customers can filter search results using an acf taxonomy filter, enhancing both usability and conversion rates.

Conclusion

Combining ACF with the Advanced Woo Search plugin is one of the most effective ways to implement powerful WooCommerce search filtering. Whether you're dealing with custom fields or taxonomies, AWS gives you full control over how products are found and displayed.

By using acf filters, you can dramatically improve product discoverability and help customers find exactly what they’re looking for - boosting both satisfaction and sales.

You can use some custom code snippets to limit product search results by ACF field, but it is a very limited approach and requires some coding knowledge.

FeatureCustom CodeAdvanced Woo Search (AWS) Plugin
Ease of UseRequires PHP knowledge and manual setupUser-friendly interface, no coding needed
Setup TimeLonger - manual coding and testing requiredFaster - mostly point-and-click configuration
Custom Field SupportYes, with proper meta query setupYes, built-in support for ACF fields
Taxonomy FilteringPossible, but requires more complex codeYes, easy setup via UI
Filter UI DisplayRequires custom theme modificationsBuilt-in filter display options (dropdowns, checkboxes, etc.)
ScalabilityGood, but maintenance can become difficultExcellent, easily managed through dashboard
FlexibilityHighly flexible for developersFlexible and extendable via plugin settings
Best ForExperienced developers who want full controlStore owners and non-developers seeking quick results

FAQ

What is the Advanced Custom Fields (ACF) plugin?
ACF is a very popular WordPress plugin used to create and manage custom fields.
Can I search for WooCommerce products by ACF fields?
Yes. With the Advanced Woo Search plugin, you can search for products via ACF fields. You just need to set it up correctly.
What ACF field types does the Advanced Woo Search plugin support?
The AWS plugin supports all ACF field types that return readable output - including text, textarea, number, email, URL, image, select, checkbox, radio button, true/false, and more.
Is it possible to filter by ACF taxonomies?
Absolutely. ACF taxonomies can be used as filtering values for AWS plugin search results.
Do I need to code to use ACF filters in search?
No. Plugins like Advanced Woo Search allow you to configure this without writing any code.
Can I search and display taxonomies created with the ACF plugin?
Yes, it is possible. You just need to enable search for the specific taxonomy.
Which plugin supports ACF search filtering best?
Advanced Woo Search is one of the most comprehensive plugins for adding ACF taxonomy filter and advanced custom fields search filter functionality to WooCommerce.

Comments

Download free version

Download free version from wordpress.org repository.

Purchase pro version

Read about differences between free and pro versions here.