HUSKY - WooCommerce Product Filter Professional

Filter WooCommerce Products by ACF Field: Types, Setup and Fixes

You can filter WooCommerce products by ACF field values with HUSKY, but only when the field stores its value in a form that a database query can compare. Single-value fields (Select, Radio Button, True / False, Number, Text, Date Picker) filter fine. Checkbox fields and Select fields with Select Multiple turned on either never appear in the filter or show options that always find 0 products. Below is how HUSKY reads ACF data, which field types work, how to set each one up, and what to do with multi-value fields.

Two ways HUSKY reads ACF fields

ACF saves every field as ordinary product meta data: one row in the wp_postmeta table, under the field's Field Name, holding the saved value. HUSKY has two built-in extensions that filter by such rows. Both are system extensions, always active, so there is nothing to switch on.

  • The ACF extension (ACF fields) finds your ACF field groups automatically and lists their Select, Radio Button and True / False fields on the Structure tab as Field label (Group title). Set the drop-down next to a field to Yes, save, and the field is in the filter. Other field types are not listed at all. Details are on the ACF extension page.
  • The Meta Data tab (Meta filter extension) works with any meta key, ACF or not. You add the key yourself and choose how it is shown: Slider, Search by text, Checkbox, Drop-down, Multi Drop-down or Datepicker, and which type of data it holds: number, string or date. See filter by meta fields.

The ACF extension is quicker to set up, but it has three rules that explain most "the field is missing" and "0 products" reports:

  1. The field group must be assigned by post type. HUSKY only picks up groups whose Location rules contain Post Type is equal to Product. A group shown only by a rule such as product category is skipped, so its fields never reach the Structure tab.
  2. Each choice's value must match its label. In ACF a choice written as xl : Extra large saves xl on the product, but the ACF extension searches for the label, Extra large, and finds nothing. Choices written as a single word per line (value and label are the same), or differing only in letter case such as red : Red, work. Labels that contain quote characters never match.
  3. Select Multiple must be off. A Select field with Select Multiple enabled is still listed, but finds no products, for the reason explained below.

If a field breaks one of these rules, filter it through the Meta Data tab instead, where you control the key and the exact values.

Which ACF field types can be filtered

ACF field typeWhat is saved on the productHow to filter it in HUSKY
Select (single), Radio ButtonOne choice valueACF extension, or Meta Data Drop-down / Multi Drop-down
Button GroupOne choice valueMeta Data Drop-down / Multi Drop-down
True / False1 or 0ACF extension, or Meta Data Checkbox
Number, RangeA numberMeta Data Slider, type number
Text, Email, URLA stringMeta Data Search by text, or Drop-down with the values listed
Date PickerA date as 20250131 (Ymd)Meta Data Datepicker plus one hook (see below)
Checkbox, Select with Select Multiple, multi-value Relationship / Post Object / TaxonomyA serialized arrayNot with a normal comparison; see the two ways out below
Repeater, Flexible ContentNumbered rows such as specs_0_widthNot filterable as one field

Fields inside a Group field are saved under groupname_fieldname and filter like their own type. A Date Time Picker saves text such as 2025-01-31 14:00:00, which the Datepicker filter cannot compare.

Why checkbox and multi-select fields find nothing

When a field can hold several values, ACF packs them into one string in PHP's serialized format. A car with air conditioning and heated seats gets one meta row like this:

a:2:{i:0;s:2:"ac";i:1;s:12:"heated_seats";}

The ACF extension and the Drop-down, Multi Drop-down and Checkbox views ask the database for rows where the value equals the selected option. ac is not equal to that whole string, so the result is 0. Switching Select Multiple off in ACF does not repair existing products: their values stay serialized until each product is saved again with a single value.

Set up an ACF field on the Meta Data tab

  1. Find the real meta key. It is the field's Field Name in ACF (for example body_type), not its label. On the Meta Data tab, Get keys from any product by its ID lists every key of a product. Each ACF field appears twice: body_type holds the value, _body_type holds ACF's internal field reference. Use the key without the underscore. Keys are case-sensitive and never contain spaces or brackets.
  2. Add the key with Add Custom key by hands or from the list, enter a title, and choose the view and the type. For text values choose string. With number, MySQL converts text such as Coupe to 0 before comparing, and the filter returns every product that has the key, which looks like "the filter does nothing".
  3. List the options for Drop-down and Multi Drop-down. A meta field is free text, so HUSKY cannot build the list of values itself; you write it, separated by commas. Use title^value when the visible title differs from the saved value. For the ACF choices coupe : Coupe and suv : SUV / Crossover that is:
    Coupe^coupe,SUV / Crossover^suv
    The part after ^ must be exactly what ACF saved, the choice value, not its label.
  4. Save, open the Structure tab, set the new item to Yes, drag it into place and save again. The cog icon next to it holds the view's own options, for example Search option and Search value for a Checkbox, or Text search conditional (LIKE or EXACT) for Search by text.

A Checkbox is a single checkbox for one key. It finds products whose value is 1 (True / False fields), another Search value such as yes, or, with Search option set to Value exists, every product that has the field filled.

If a saved value itself contains a comma, change the separator for all Drop-down and Multi Drop-down lists, then rewrite the lists with |:

/*
 * HUSKY: separate meta filter options with | instead of a comma.
 * Child theme functions.php or a code snippets plugin.
 * Example list afterwards: Wood, oak|Wood, pine|Metal
 */
add_filter( 'woof_meta_options_separator', function ( $separator ) {
    return '|';
} );

Number and Range fields belong in a Slider; ranges, steps and decimals are covered in range slider filters for attributes and meta fields.

Filter by an ACF date field

The Datepicker filter compares Unix timestamps by default, while ACF's Date Picker saves dates as 20250131. The hook woof_meta_use_acf_dateformat makes the filter convert the chosen dates to the same format before searching:

/*
 * HUSKY: Datepicker meta filters search ACF Date Picker values (Ymd).
 * Child theme functions.php or a code snippets plugin.
 */
add_filter( 'woof_meta_use_acf_dateformat', '__return_true' );

Add the ACF key on the Meta Data tab with the Datepicker view and keep the type on number: the converted dates are compared as numbers, and the date type does not produce usable dates here. The hook applies to every Datepicker filter on the site, so all of them must then point to ACF Date Picker fields. For a validity period (from / to), add the start and end fields as two separate filters.

Checkbox and multi-select fields: two ways out

Recommended: move the values to a taxonomy

Data with several values per product is what taxonomies are made for. With a taxonomy you get a checkbox for every value, counts, AND or OR logic between the selected values and Turbo mode support, which a meta field cannot offer. You do not have to give up ACF for editing:

  1. Create a product taxonomy, for example Equipment, as a custom taxonomy or as a global attribute under Products → Attributes.
  2. In ACF, replace the Checkbox field with a Taxonomy field that points to it, with Save Terms and Load Terms turned on. ACF then assigns the chosen terms to the product instead of storing an array.
  3. Products get their terms when they are saved again; for a large catalog do it in bulk. The taxonomy then appears on HUSKY's Structure tab like any other.

Keep the field: search inside the stored array

If the field must stay as it is, the comparison can be changed. The snippet below turns HUSKY's "equals" condition for the listed keys into a LIKE search for the quoted value, so ac becomes LIKE '%"ac"%' and matches the element inside the serialized string, but not ac_rear. It also fixes the option counts.

/*
 * HUSKY: Drop-down / Multi Drop-down meta filters for ACF Checkbox
 * and Select Multiple fields (values stored as serialized arrays).
 * Child theme functions.php or a code snippets plugin.
 */
function my_husky_serialized_keys() {
    return array( 'equipment' ); // ACF field names
}

function my_husky_match_serialized( $meta_query ) {
    if ( ! is_array( $meta_query ) ) {
        return $meta_query;
    }
    foreach ( $meta_query as $i => $clause ) {
        if ( ! is_array( $clause ) ) {
            continue;
        }
        if ( isset( $clause['key'], $clause['value'], $clause['compare'] )
            && '=' === $clause['compare']
            && is_scalar( $clause['value'] )
            && in_array( $clause['key'], my_husky_serialized_keys(), true ) ) {
            $meta_query[ $i ]['compare'] = 'LIKE';
            $meta_query[ $i ]['value']   = '"' . $clause['value'] . '"';
            $meta_query[ $i ]['type']    = 'CHAR';
        } else {
            $meta_query[ $i ] = my_husky_match_serialized( $clause );
        }
    }
    return $meta_query;
}

// Products found by the filter
add_filter( 'woof_get_meta_query', 'my_husky_match_serialized', 100 );

// Counts next to the options (Show count + Dynamic recount)
add_filter( 'woof_dynamic_count_attr', function ( $args ) {
    if ( isset( $args['meta_query'] ) ) {
        $args['meta_query'] = my_husky_match_serialized( $args['meta_query'] );
    }
    return $args;
}, 100 );

Then add equipment on the Meta Data tab as a Drop-down or Multi Drop-down, type string, with the ACF choice values after ^, for example Air conditioning^ac,Heated seats^heated_seats. Know the limits: a Multi Drop-down finds products that have any of the selected values, not all of them; a LIKE '%…%' search cannot use a database index and gets slower on large catalogs; and the snippet does not apply in Turbo mode. More about the hook on the woof_get_meta_query page.

Variations, Turbo mode and custom product grids

  • Values on variations are not searched. The shop query returns parent products and checks the parent's own meta. Attributes work for variations because the parent carries all its variations' terms; meta values do not. Put the value on the parent product.
  • Turbo mode filters in the browser from its own data file, which includes only the keys added on the Meta Data tab. Fields shown through the ACF extension, and PHP hooks such as the snippets above, are not used there. See Turbo mode troubleshooting.
  • The URL changes but every product is still shown. Then the problem is not the field: the page builder grid or custom template runs its own query and ignores every filter. The fix is in filter URL changes but products are not filtered.

If the ACF filter still finds no products

  • Check what is really saved. In phpMyAdmin or a similar tool run SELECT meta_key, meta_value FROM wp_postmeta WHERE post_id = 123 with a product ID (and your table prefix). A value starting with a: is a serialized array; a different key than you expected means ACF saves under another name.
  • Meta Data tab: the key without the leading underscore, in the same case; type string for text; the saved choice value after ^.
  • For the ACF extension: the group's location is Post Type is equal to Product, choice values match their labels, Select Multiple is off and the products were saved again after changing it.
  • The value sits on the parent product, not on variations.
  • A taxonomy filter works on the same page. If it does not, fix the product grid first.

If every point checks out and the filter still finds nothing, open a topic on the HUSKY support forum with the field's type and settings, the meta key and a sample of the saved value, and we will look at it.