Skip to content

Repository files navigation

Woodmart Hierarchical Product Filter

Notice

This plugin is provided as-is, with no support or ongoing maintenance. Anyone is free to fork, modify, and use it however they like. Pull requests and issues will not be reviewed or merged. If you want to give a shout-out, that's appreciated but not required.

Tags: woocommerce, filter, product filter, hierarchical, woodmart, ajax, category, attribute, shop, open source

Advanced hierarchical product filtering for WooCommerce.

Version: 1.0.1
WooCommerce Compatibility: 7.0+ with full HPOS support

Description

This plugin extends WooCommerce and the Woodmart theme to provide advanced hierarchical/dependent product filtering capabilities. It allows you to create multi-level filters where each selection affects the available options in subsequent filter levels. Fully compatible with WooCommerce HPOS (High Performance Order Storage) and optimized for modern WordPress environments. No admin interface required – configure all settings via shortcode parameters or the classic widget.

This plugin is open source. No official support is provided. The community is welcome to fork, improve, and contribute via GitHub.

Features

  • Hierarchical Filtering: Create dependent filters where each selection affects subsequent options
  • Multiple Filter Types: Support for both product attributes and categories
  • Shortcode Support: Flexible shortcode for any page or post
  • Widget Support: Traditional WordPress widget
  • Category Filtering: Include/exclude specific categories
  • Product Counts: Show product counts for each filter option
  • Responsive Design: Mobile-friendly interface
  • Performance Optimized: Caching and efficient database queries
  • Security Enhanced: Nonce verification and input sanitization
  • Error Logging: Comprehensive logging for debugging
  • WooCommerce Compatible: Full compatibility with latest WooCommerce features
  • HPOS Ready: Optimized for WooCommerce's High Performance Order Storage
  • PHP 8.0+ Safe: No array key warnings or compatibility issues

Requirements

  • WordPress 5.0 or higher
  • WooCommerce 7.0 or higher (for full HPOS compatibility)
  • PHP 7.4 or higher

Installation

  1. Download and extract the plugin files
  2. Upload the entire woodmart-hierarchical-filter directory to /wp-content/plugins/
  3. Activate the plugin through the 'Plugins' menu in WordPress

Usage

Shortcode

Add the filter anywhere using the [woodmart_hierarchical_filter] shortcode. You can customize the filter levels, types, labels, and more.

Basic Example

[woodmart_hierarchical_filter attributes="brand,model,power" types="attribute,attribute,attribute" labels="Brand,Model,Power"]

Category and Attribute Filtering

[woodmart_hierarchical_filter attributes="category,brand,category" types="category,attribute,category" labels="Main Category,Brand,Sub Category" include_categories="electronics|automotive,,clothing|accessories" exclude_categories="uncategorized,,sample|test"]

Custom Button Texts

[woodmart_hierarchical_filter attributes="brand,model" types="attribute,attribute" labels="Brand,Model" filter_button_text="Apply Filters" clear_button_text="Reset" show_clear_button="yes"]

Advanced Example: Automotive Store

[woodmart_hierarchical_filter 
   attributes="category,brand,category,model" 
   types="category,attribute,category,attribute" 
   labels="Vehicle Type,Brand,Series,Model" 
   include_categories="cars|trucks|motorcycles,,sedans|suvs|pickups,"
   exclude_categories="discontinued,,concept,"]

Advanced Example: Electronics Store

[woodmart_hierarchical_filter 
   attributes="category,brand,category,size" 
   types="category,attribute,category,attribute" 
   labels="Department,Brand,Product Type,Size" 
   include_categories="electronics|clothing|home,,smartphones|laptops|shirts|pants,"
   exclude_categories="uncategorized|sample,,discontinued,"]

Classic Widget

  1. Go to Appearance → Widgets
  2. Add the "Woodmart Hierarchical Filter" widget to your desired widget area
  3. Configure the filter settings (attributes, types, labels, etc.)

Filter Parameters

  • attributes: Comma-separated list of filter attributes (e.g., "brand,model,power")
  • types: Comma-separated list of filter types ("attribute" or "category")
  • labels: Comma-separated list of display labels
  • show_counts: Show product counts (yes/no)
  • include_categories: Categories to include (use | to separate multiple categories)
  • exclude_categories: Categories to exclude (use | to separate multiple categories)
  • filter_button_text: Custom text for filter button
  • clear_button_text: Custom text for clear button
  • show_clear_button: Show/hide clear button (yes/no)

Troubleshooting

Common Issues

  1. Filters Not Working:

    • Check that WooCommerce is properly configured
    • Ensure products have the required attributes
    • Verify product categories are set up correctly
  2. Performance Issues:

    • Enable caching in the plugin settings
    • Check server performance and database optimization
    • Consider reducing the number of filter levels
  3. AJAX Errors:

    • Check browser console for JavaScript errors
    • Verify nonce is being generated correctly
    • Check server error logs

Debug Mode

Enable WordPress debug mode to see detailed error messages:

// Add to wp-config.php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);

Logging

The plugin uses WooCommerce's logging system. To view logs:

  1. Go to WooCommerce → Status → Logs
  2. Look for logs with source "whf-plugin", "whf-filter", or "whf-admin"

Security

The plugin implements several security measures:

  • Nonce Verification: All AJAX requests are protected with nonces
  • Input Sanitization: All user inputs are properly sanitized
  • Capability Checks: Admin functions check user capabilities
  • SQL Prepared Statements: Database queries use prepared statements
  • XSS Protection: Output is properly escaped

Community & Contributing

This plugin is not officially supported. Please do not contact the original authors for support. If you encounter issues or want to improve the plugin, you are encouraged to fork the repository and submit pull requests or open issues on GitHub.

  • Fork the plugin and make it your own!
  • Submit improvements via pull requests
  • Report bugs and suggest features via GitHub issues

License

This plugin is licensed under the GPL v2 or later.

Credits

Originally developed by K2D | SoloByte Ltd. for enhanced WooCommerce filtering capabilities.

** No official support is provided. Fork, improve, and share!**

About

This plugin extends WooCommerce and the Woodmart theme to provide advanced hierarchical/dependent product filtering capabilities.

Topics

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages