Meta Key for Postmeta Range or Postmeta Toggle filter

Our Postmeta Range filters and Postmeta Toggle filters both allow you to filter your products by any meta_key that exists in your database. First, make sure your product has the required information in the ‘Edit Product’ settings. If you are on the Edit Product page, under Screen Options, ensure the Custom Fields flag is enabled to let you view your product meta data.

Note that meta_keys with an underscore prefix, e.g. _weight are invisible to this Custom Fields area, so if you are creating your own meta keys, don’t use an underscore prefix or it’ll make it harder to examine and debug your product info.

Also note that filtering on meta_keys is slower than filtering on attributes or taxonomies. We are working on making meta filtering as fast as attribute and taxonomy filtering, but it’s worth bearing in mind that since meta data does not have associated tables telling us all the possible values that this affects performance.

Choose the meta key in the widget

Set the desired meta key to whatever meta_key you wish to filter by for your toggle or range filter.

Example Hidden Meta Keys

These hidden meta keys all come along with WooCommerce by default and you can edit them using the WooCommerce interface.

  • _weight – editable in Inventory
  • _height – editable in Inventory
  • _length – editable in Inventory
  • _width – editable in Inventory
  • _price – not editable – this is calculated as the cheaper of _regular_price and _sale_price so long as _sale_price is not empty
  • _regular_price – this is the retail price
  • _sale_price – this is the sale price
  • _wc_average_rating – the average product rating for WooCommerce products

When creating your own meta keys, avoid prefixing the key with _ to avoid them being hidden in the Custom Fields editor interface.

 

 

 

Be the first to comment and we'll reply right away.

Leave a reply

Super Speedy Plugins
Logo