Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Cats and Metas

// WP_Query arguments
$args = array(
	'post_type'              => array( 'product' ),
	'post_status'            => array( 'publish' ),
	'posts_per_page'         => '-1',
	'tax_query'              => array(
		array(
			'taxonomy'         => 'product_cat',
			'terms'            => '$catID',
			'field'            => 'term_id',
		),
	),
	'meta_query'             => array(
		array(
			'key'     => '_brand',
			'value'   => '$brand',
			'compare' => '=',
		),
	),
);

// The Query
$query = new WP_Query( $args );