WooCommerce has default settings to get reviews only from the verified purchasers.
Got to WordPress admin > WooCommerce > Settings > Products. You’ll see a tick box called ‘Reviews can only be left by "verified owners"'. If you tick this box, only logged in users who have purchased the product will be able to leave a review. Non-buyers will see a note saying “Only logged in customers who have purchased this product may leave a review”.
For any further query please feel free to reach out to our Dedicated Support Team.