We’ve got an Ask SkyVerge questions queued up for today from Sam:
Is there a way to display the WooCommerce review tab only for customers who bought the product? That way users who never bought the product will not be able to see the review tab.
Product reviews are one of the most important indicators of social proof for an eCommerce site, and they’re an excellent tool to help customers make purchasing decisions and learn about your products. They also provide a great source of user-generated content on your site (that’s why we built WooCommerce Product Reviews Pro to help you enhance your review display).
However, if your store doesn’t yet have a lot of reviews, the lack of social proof could negatively impact your sales, as a lack of reviews can make your store look like a ghost town or that nobody has yet purchased (which is why getting more reviews should be a priority for your store).
Until you have reviews to showcase, we could use a snippet to achieve Sam’s goal here: we can hide the reviews for the product until a customer has purchased that product, then re-add the WooCommerce product reviews tab for verified purchasers.
WooCommerce has a useful helper function for us to check whether a particular customer has purchased a product or not:
We can get the current user’s ID and use this function to see if they’ve purchased a product while they’re viewing it. If they have not purchased, we’ll remove the reviews tab so that only verified purchasers will see the list of reviews:
There we have it! This completely removes the WooCommerce product reviews tab until a customer has purchased the product.
There is one caveat you should note before we wrap up: customers who are not logged in (or guest customers) will not see reviews, and cannot leave review for your product if you take this route. This is because we have no idea of knowing their email address as they browse your site (and they don’t have a user ID as a guest).
Since we don’t have that information, it’s impossible to check if they’ve purchased, and therefore allow them to leave a review. If you wanted guest purchasers to be able to leave feedback and reviews about your product, you’d need to have another way to accept those reviews and add them to the product manually.