Hello,
You can copy related.php (xstore/woocommerce/single-product) to xstore-child/woocommerce/single-product and make such changes https://prnt.sc/iwgubc:
$cats_array = wp_get_post_terms($product->get_id(),'product_cat',array('fields'=>'ids'));
$args = apply_filters( 'woocommerce_related_products_args', array(
'post_type' => 'product',
'ignore_sticky_posts' => 1,
'no_found_rows' => 1,
'posts_per_page' => $posts_per_page,
'orderby' => $orderby,
'post__in' => $related,
'post__not_in' => array( $product->get_id() ),
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'field' => 'id',
'terms' => $cats_array
)
)
) );
Regards