I am trying to display the related product which is related to the post author since I only want to show products or the product that was created by the same user
global $post;
$authorid = $post->post_author;
foreach ( $related_products as $related_product ) :
$post_object = get_post( $related_product->$authorid );
setup_postdata( $GLOBALS['post'] =& $post_object );
wc_get_template_part( 'content', 'product' );
endforeach;
however it doesn't show anything
You could do something like this which will remove any products not created by the product's author from the related products array. Place this code in your functions.php file.