WooCommerce Products Meta Data Filters

WooCommerce Products Meta Data Filters is a simple but powerful WordPress plugin to filter your WooCommerce products

Filter by product weight, product length, product width, product height, product custom fields, product ACF fields and much more!

Features

  • No complicated settings page. Simple and easy administration via Widgets.
  • Works out of the box.
  • Auto discovers all default and custom meta keys.
  • You can create unlimited product filters and combine them.
  • Extensible / developer friendly. You can alter the plugin without hacking it, but via WordPress filters and actions.
  • Works on all WooCommerce setups and themes.
  • Easily translatable via .po / .mo files.

Requirements

  • WordPress 4.0+
  • WooCommerce 3.0+
  • PHP 5.4+

Usage

On wp-admin, click on Appearance on the left menu and then on the Widgets submenu. Locate the “Filter products by Meta” widget and add it on the appropriate sidebar

On the widget options fill in the fields depending on your needs

Options
  1. Title: Enter the title of the widget. Most of the times it is placed on the top of the widget as a header.
  2. Label: Put the label of the element you are filtering eg. “Width:”
  3. Meta Key: Select the meta key you want to filter by
  4. Filter type: Select “List” to display all available values of this meta key or “range” to create a slider if you are filtering by a numeric value, eg. the weight of the products
  5. Order options: Select the order of the filter’s values
  6. Order Autorefresh: This will remove the submit button from a “range” filter and will auto submit the filter when it has been changed
  7. You are ready to go! * Save *

For Developers

Some hooks are in place. Please search the code for a full list. Below are some of them with examples.

Filters

You can make the filters display in every page you want. The code below will make them display on every page that has the containing sidebar.

add_filter( 'wmf_display_condition', 'my_wmf_display_condition');
function my_wmf_display_condition( $condition ) {

  return true;
}

You can change the list of the filter types.

add_filter( 'wmf_filter_types', 'my_wmf_filter_types');
function my_wmf_display_condition( $types ) {

  $types['checkbox'] = __( 'Checkbox', 'wmf');

  return $types;
}
Actions

You may add your own behaviour on your filter type

add_action( 'wmf_widget_end', 'my_wmf_widget_end', 10, 7 );
function my_wmf_widget_end( $title, $valueslabel, $metakey, $filtertype, $orderby, $autorefresh, $values_array ) {
  // your code here
}

Frequently Asked Questions

  1. Can I filter by any custom field (meta data)?

    Yes, you can.

  2. How do I add my custom meta data on a product?

    Edit the product in wp-admin. On the top – right corner of the screen, click on “screen options” and make sure that “Custom Fields” is checked. Scroll to the custom fields metabox and add your custom meta data.
    Read more on custom fields

  3. Can I put this anywhere in my site?

    You can put it on any sidebar on your website.

  4. What default fields can I filter by?

    Some of the default filter fields are:

    • weight
    • length
    • width
    • height
    • visibility
    • stock status
    • total sales
    • sales price
    • regular price
    • tax status
    • tax class
    • featured
    • sku
    • reviews count
    • average rating
  5. Can I read the documentation?

    About / Documentation

Changelog

1.0.0 04/24/2019
  • Initial release

Sources and Credits

This plugin uses the following libraries

This plugin uses the following libraries