0

I want to fetch a list of bundled products using WP_Query.I have used the following

   $args = array( 
            'post_type' => 'product',               
            'posts_per_page' => 9, 
            'orderby' =>'date',
            'orderby' => 'rand', 
            'meta_query'=>array(
                array(
                    'key'=>'_thumbnail_id', 

                )
            )
        );

 $loop = new WP_Query( $args );

How can i pass an argument to get bundled products? Can anyone help please..

Thanks

1

You should be able to do it using 'tax_query':

'tax_query'=> array(
    array(
        'taxonomy' => 'product_type',
        'field'    => 'slug',
        'terms'    => 'bundle', 
    ),
),
  • Thanks mate! already fixed,forgot to update it here.Anyway this was the correct answer. – AVM Aug 29 '16 at 7:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.