Try to get category info using
$category = get_queried_object();
$cpt_cat = $category->term_id;
$args = array(
'post_type' => 'product',
'posts_per_page' => 10,
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'field' => 'term_id',
'terms' => $cpt_cat,
),
),
);
// Custom query.
$query = new WP_Query( $args );
if ( $query->have_posts() ) {
global $wpdb;
/* Start the Loop */
while ( $query->have_posts() ) : $query->the_post();
?>
// Put your HTML stuff here
<?php
}
endwhile;
// Restore original post data.
wp_reset_postdata();
} ?>
And use category id/slug in your query for result.
Hope this will help!