Output product category link from WP_Query

I have a WP_Query that outputs products from given Product category name. For each product list I would also like to link to the category of that product, but I'm not sure how.

My query:

?php
$new_posts = new WP_Query([
  'product_cat' = 'printer',
  'post_type' = 'product',
  'orderby' = 'meta_value_num',
  'order' = 'DESC',
  'meta_key' = 'view_count',
  'posts_per_page' = 9,
]);
?

Output link something like this:

  a href=?php echo $cat_id ? class=procat-linkMore Products.../a

Topic woocommerce-offtopic functions wp-query php Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.