Woocommerce: Show products filtered by attribute

I want to filter products by attribute in Woocommerce using a checkbox or alternatively a link. If I mark the checkbox or click the link I want get all products that have this attribute.

How can I do this? Which files should I edit?

Read More

Edit: Now i need do a query to get all products that have a custom attribute ‘demo’ in my case.

I’m doing this:

$args = array ( 'meta_query' => array( 
array( 'key' => 'meta_value', 
       'value' => 'demo', 
       'compare' => 'LIKE', ), 
       ), 
);

Whats wrong??

Thanks!

Related posts

1 comment

  1. Ok i got finally the result!

    I have this:

    $args = array ( 
         'post_type'  => 'product',
         'posts_per_page'  => 12,
         'meta_query' => array( 
             array( 
              'value' => 'demo', 
              'compare' => 'like'
             ), 
           ), 
    

    );

    Thanks anyway for the help!

Comments are closed.