-1, 'post_type' => 'product', 'post_status' => 'publish', 'orderby' => 'name', 'order' => 'ASC', 'tax_query' => array( array( 'taxonomy' => 'pa_online-amazon', // Woocommerce product category taxonomy 'field' => 'slug', // can be: 'name', 'slug' or 'term_id' 'terms' => 1, ) ), ) );$results = []; // Initializingif ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); $product_id = get_the_ID(); $product_name = get_the_title();$results[] = $product_name .' ('.$product_id.')'; endwhile; wp_reset_postdata();// Displaying results printf( '

Retrieved products are:
%s

', implode(',
', $results) ); else : echo '

No results found.

'; endif; wp_reset_query(); ?>