I try this code for display all products from this brand taxonomy page in one page. I dont know what to put on 'terms' => array( 'print-the-current-brand-name-from-page' ) //brand name here
The full code is
<?php
// get products
$args = array(
'post_type' => 'product',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'pwb-brand', //brands are terms of 'pwb-brand' taxonomy
'field' => 'name', //search by term name
'terms' => array( '' ) //brand names here
)
)
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
while ( $loop->have_posts() ) : $loop->the_post();
wc_get_template_part( 'content', 'product' );
endwhile;
} else {
echo __( 'not found anyhting.' );
}
wp_reset_postdata();
?>