← BACK TO THE BLOG

How to Filter WooCommerce Products by Category

To filter WooCommerce products by category, first assign products to clear categories, then expose Categories in a HookSpark Product Filters set. Keep Catalog category on All categories when shoppers should choose across the store; choose a specific catalog category when the whole filter catalog must stay inside that section.

This tutorial covers the plugin’s own shortcode catalog and the category controls in its base plugin. It does not assume that a filter set rewrites every theme’s Shop page, Elementor grid or WooCommerce Product Collection block. Our example separates mugs from clothing, then checks coffee and tea subcategories.

Category navigation or a category filter?

A normal WooCommerce category link is enough when the customer simply needs to open a section such as Mugs. Use an interactive filter catalog when shoppers need to refine products while seeing the current results. A category groups a product type; an attribute describes a property such as color or material. For those properties, use our guide to filtering WooCommerce products by attribute.

WooCommerce’s “Managing Product Categories, Tags and Attributes” documentation describes categories as hierarchical groups with parent and child categories. Source: WooCommerce documentation, consulted October 24, 2026. That hierarchy is why including subcategories changes the products returned; it is not a claim about higher conversion rates.

1. Create categories and assign the products

In Products → Categories, create Mugs and Clothing. Add Coffee cups and Tea cups as children of Mugs. Assign one test mug directly to Mugs, a coffee cup only to Coffee cups, a teacup only to Tea cups, and a shirt to Clothing. Publish these test products with prices and appropriate catalog visibility. Category names in this example are yours to create; they are not bundled product data.

2. Add Categories to the filter set

Open HookSpark → Product Filters → Filter sets and create or edit a set. Give it a useful Set name. Under Available filters, select Categories. Set Catalog category to All categories for the first test and Subcategories to Include subcategories. Enable this filter catalog and select Save filter set. Refresh preview lets you inspect changes; saving is the step that persists the set.

SettingPurposeExample
Available filters: CategoriesWhat shoppers can selectMugs or Clothing
Catalog categoryPermanent scope of this catalogAll categories or Mugs only
Include subcategoriesWhether child-only assignments qualifyCoffee cups included under Mugs
Save filter setPersist the configurationCheck the storefront after saving
A six-product catalog is narrowed to three mugs by selecting the cup category.
The category selection narrows a mixed catalog to mugs. Simplified illustration: the actual filter controls follow your saved set.

3. Place and test the saved shortcode catalog

Copy the exact shortcode shown for your saved set and insert it in a WordPress Shortcode block on a test page. Use the generated set identifier, not a made-up ID. Open that page as a logged-out shopper and select Mugs. With subcategories included, the directly assigned mug, coffee cup and teacup should qualify; the shirt should not. Check the result after changing the selection, not just the admin preview.

4. Decide whether parent categories include their children

Switch Subcategories to Direct category assignments only, save and repeat the Mugs selection. Now the product assigned only to Coffee cups should not qualify for Mugs. The same applies to Tea cups. A product assigned directly to Mugs still qualifies. This setting applies both to the catalog’s starting category and to category filters, so review it before assuming a parent category is empty.

A parent cup category branches into coffee and tea subcategories; a reset arrow returns to the parent scope.
Including child categories brings coffee and tea products into the parent scope. Resetting shopper filters should preserve a merchant-defined starting category.

5. Keep reset inside the right catalog

For a mugs-only page, set Catalog category to Mugs and enable Include subcategories again. Save, reload the page, select a child category and then reset the shopper filters. The initial mugs catalog should return, including its child categories; clothing must stay outside it. Reset removes shopper selections, not the category constraint chosen by the merchant.

Why is a product missing from a category filter?

Check its category assignments, published status, price, catalog visibility and stock settings, then check the set’s starting category and subcategory policy. A filter cannot include an item outside the saved scope. Test the exact page on mobile and verify the normal form submission too; for the separate no-reload behavior, see our WooCommerce AJAX product filter tutorial.

Will this automatically replace my existing Shop grid?

No. This walkthrough uses the plugin’s own shortcode catalog. An existing archive or page-builder grid needs its own supported integration and a separate check. Review the Product Filters documentation, then try HookSpark Product Filters with a small category tree before adapting your full catalog.

Marco Salvo

ABOUT THE AUTHOR

Marco Salvo

Founder of HookSpark.

Meet Marco, founder of HookSpark →

Screenshot preview