Depending on where whoocommerce posts are stored, you could do this via basic WordPress post queries, via:
$args = array(
'post_type' => 'your_post_type',
'category_name' => 'your_category',
'tag' => 'your_tag'
);
$arr_posts = new WP_Query($args);
if ($arr_posts->have_posts()) {
while ($arr_posts->have_posts()) {
echo $arr_posts->the_post();
// Echo out content of each post, but here you may do whatever you want
the_content();
}
} else {
echo "<p class="error">No posts fulfill your search criteria!<p>";
}
Note that you can adapt your query parameters, by specifying additional query criteria in the $args array (or take out any of the ones I provided, if you please).
I’ve added an error class to your error feedback such that you can style it in CSS as you may please (color:red; etc). Again, this example works if your product posts are stored in the wp_posts database. If not, you may do something similar, by querying in the corresponding database holding your product posts.
Just found this https://wp-staging.com/in-which-database-table-is-woocommerce-storing-products/, so the code above should definitely work.