Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to filter WooCommerce products by custom attribute

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 4.07k
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: