HUSKY - WooCommerce Product Filter Professional

WooCommerce Year Make Model Filter with Dependent Drop-downs

A WooCommerce year make model filter asks for the make first, then offers only the models of that make, then only the years of that model, and shows the parts that fit. HUSKY builds this with the Hierarchy drop-down filter type. Whether it works depends less on settings than on how the vehicle data is stored: the drop-downs can only follow a parent and child structure that already exists in one taxonomy. Below: how the dependent drop-downs work, how to structure the data, the setup, and what to check when the second drop-down stays empty.

How a year make model filter works in HUSKY

The Hierarchy drop-down reads one hierarchical taxonomy, the same kind of tree as product categories. The first drop-down lists the top-level terms (the makes). When the visitor picks Audi, the form is drawn again and the second drop-down lists the children of Audi (its models), then the children of the chosen model (its years), as deep as the tree goes.

The dependency comes from the tree itself, not from the products. After Audi, the second drop-down shows Audi's models and nothing else, even if some parts also fit a BMW. That is exactly what a vehicle selector needs, and it has three consequences:

  • Make, model and year must be levels of the same taxonomy. A brand taxonomy and a model taxonomy cannot be chained, and neither can product categories and tags.
  • Product attributes (pa_make, pa_model) cannot be chained, because WooCommerce attributes have no parent and child terms.
  • Custom fields (ACF fields, meta values from an import) cannot be used, because the type works only with taxonomy terms.

Each choice replaces the previous one in the search: after Audi → A4 → 2015 the search contains only the last term, for example vehicle=2015-a4. On the results page the plugin rebuilds the whole chain from that term, so the drop-downs show Audi, A4 and 2015 again.

Structure the vehicle data first

Product categories or a separate taxonomy

You can build the tree in product categories (Make → Model → Year), and it works. In a parts shop, though, categories usually describe the part (brakes, filters, lighting) and visitors want to filter by both. Then create a separate hierarchical taxonomy for products, for example Vehicles, with Custom Post Type UI or your own code. Creating a custom taxonomy shows the steps; the important part is setting Hierarchical to true and attaching it to Products.

One branch per model

Pick the order your customers think in; Make → Model → Year is the most common. Each model gets its own year terms, so the term 2015 exists once under A4 and once under Golf. That is correct: WordPress allows the same name under different parents and makes the second slug unique by adding the parent's slug (for example 2015-a4). For year ranges, name a term "2012–2016" and keep a slug such as 2012-2016. If you use the SEO URL request extension, avoid -and-, -or- and -to- inside slugs: the plugin uses them as separators in filter URLs.

Assign products to every vehicle they fit

A part that fits the Audi A3 2012–2016 and the BMW X5 2016–2018 is assigned to both year terms. With the default OR logic, assigning only the last level is enough: when a visitor has chosen only the make, WordPress includes the child terms in the search. If you set Logic of filtering to AND for this taxonomy, the plugin stops including child terms, and the product must also be assigned to the make and the model. The FAQ on category hierarchy filtering has a snippet that ticks the parent terms automatically when a product is saved.

For thousands of products, assign terms by import. The standard WooCommerce product importer understands paths in the Categories column: Audi > A4 > 2015 creates the missing terms and assigns the product to the last one, and several paths are separated by commas. For a custom taxonomy you need an import tool that supports custom taxonomies.

Universal products

There is no setting that makes a product match every vehicle. Either assign universal products to every last-level term, accepting that no year will ever look empty, or keep them out of the vehicle tree and put a link to a "Universal accessories" category next to the selector.

Set up the hierarchy drop-down

  1. In WooCommerce → Settings → Products Filter → Extensions, activate Hierarchy drop-down and save.
  2. In the Structure tab, enable your vehicle taxonomy and choose Hierarchy drop-down as its type.
  3. Open the taxonomy's additional options (the gear icon) and fill in Taxonomy custom label, for example Make+Model+Year^Find parts for your car.
  4. In the same window set Show title label to Yes if you want the block title, and Show chain always to Yes if all three drop-downs should be visible from the start.
  5. In the Options tab, switch on Show count, Dynamic recount and Hide empty terms if makes, models and years without products should not be offered (more in how to hide empty terms).

In the label, the parts separated by + are the placeholders of the drop-downs in order: the first drop-down shows "Make", the second "Model", the third "Year". The text after ^ is the block title. Without ^ the block title would be the whole string, pluses included. With Show chain always the plugin draws as many drop-downs as there are parts; the ones that cannot be used yet are disabled and show their placeholder until the previous level is chosen.

Make the next drop-down appear without a page reload

The next drop-down is built by the server from the current choice, so after each choice the browser has to ask for a new form. Two settings decide how: autosubmit and ajax_redraw in the [woof] shortcode, or Autosubmit and Form AJAX redrawing in the widget. When a drop-down changes, the plugin reacts only if autosubmit is on.

autosubmitajax_redrawWhat happens after each choice
00 or 1Nothing. The next drop-down appears only after the visitor clicks Filter and the results load.
10Every choice runs the search: the products update and the next drop-down arrives with them. Good for the shop sidebar.
11Every choice only redraws the form in the background, without searching products. The Filter button runs the search. Good for a vehicle selector.

A selector that shows only the vehicle drop-downs looks like this (replace vehicle with your taxonomy slug):

[woof tax_only="vehicle" by_only="none" autosubmit=1 ajax_redraw=1]

tax_only limits the form to the vehicle taxonomy and by_only="none" hides the price, text search and other non-taxonomy filters. The plugin reads autosubmit and ajax_redraw from the first filter form on the page, so a second HUSKY form (a header search, a sidebar widget) can override the selector's behaviour. Keep one form per page where you can.

A vehicle search box on the homepage

Put the shortcode above on the homepage. On a page that is not a shop archive, the Filter button opens the shop page with the chosen vehicle; add redirect="https://example.com/parts/" to send visitors to another results page instead. The shop page can keep its usual sidebar filter; if it shows the vehicle taxonomy as a hierarchy drop-down too, the chain arrives preselected. Redirect rules, AJAX mode and the static front page are covered in the product filter on the homepage or a custom page.

When the data are attributes: what works instead

If make, model and year are already stored as attributes, the drop-downs cannot depend on each other through a tree. Two options come close:

  • Dynamic recount with hidden empty terms. With the same autosubmit and ajax_redraw settings, after the visitor picks Ford every model that has no products among the Ford results is hidden. The limit: the plugin only hides values with zero products in the current results. A part that fits a Ford Focus and a Toyota Yaris keeps Yaris in the model list after Ford is chosen, and a part sold for 1994–2024 keeps every year visible. The plugin cannot know which year belongs to which model, because attributes are not related to each other.
  • The Step by step filter ([woof_step]) shows the filters one at a time like a wizard. It works with any filters, attributes included, but uses the same relevance rule, so the same leaks remain.

For exact fitment, move the data into one hierarchical taxonomy; it is a one-time import.

Drop-downs in one row

By default the drop-downs are stacked. To place them side by side in a wide area (above the products or on the homepage), add this CSS in Appearance → Customize → Additional CSS or your child theme's stylesheet. It works with the native, Chosen and SelectWoo drop-down skins and wraps to separate rows on narrow screens:

/* HUSKY: hierarchy drop-downs side by side */
.woof_container_select_hierarchy .woof_block_html_items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.woof_container_select_hierarchy .woof_block_html_items > select,
.woof_container_select_hierarchy .woof_block_html_items > .chosen-container,
.woof_container_select_hierarchy .woof_block_html_items > .select2-container {
    flex: 1 1 180px;
    min-width: 0;
}

If the next drop-down stays empty or disabled

  • Autosubmit is off. With autosubmit=0 a choice does nothing until Filter is clicked, even with ajax_redraw=1. Use the combinations from the table.
  • Another form controls the page. Remove other HUSKY forms from the page and test again.
  • The chosen term has no children. Check the tree in the taxonomy's admin screen. A model without year terms ends the chain there; with Show chain always the year drop-down stays disabled.
  • The children have no products. With Hide empty terms on, models and years without products are not offered. If no first-level option has products, the plugin hides the whole block after the page loads, so the selector appears for a moment and disappears.
  • New terms are missing. With Cache terms on, click clear terms cache in Advanced → Options after importing new vehicles.
  • Turbo mode is on. It replaces the normal search request with its own. If the chain does not open, test once with Turbo mode switched off.
  • The tree is in product categories and you are on a category page. There the chain starts at the current category, and on a last-level category (a year) the block is not shown; see why the filter shows only subcategories on a category page.

If the chain still does not open, open a topic on the HUSKY support forum with a link to the page, the shortcode or widget settings you use and the taxonomy's custom label.