Hello Everyone, in this blog I teach you how to filter WooCommerce products by custom attribute.
There are wide range of filter Plugins for filter product with custom attribute in WooCommerce like :
1. YITH WooCommerce Ajax Product Filter
2. WooCommerce Products Filter
3. Advanced AJAX Product Filters, etc.
If you want to make your custom product filter. you just copy mine code.
<?php
$args=array('meta_query'=>$meta_query,'tax_query'=>array($query_tax),'posts_per_page' => 10,'post_type' => 'ad_listing','orderby'=>$orderby,'order'=>$order ,'paged'=>$paged);
where "$meta_query" is:
$key="your_custom_key"; //custom_color for example
$value="blue";//or red or any color
$query_color = array('key' => $key, 'value' => $value);
$meta_query[] = $query_color;
query_posts($args);
0 Comment(s)