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: wc_customer_bought_product() function

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.

Published by Beka Rice

Beka manages WooCommerce product direction for SkyVerge, such as plugin roadmaps, documentation, and sales copy. She typically gets stuck with boring administrative tasks, but likes to write so she has an excuse to spend more time jamming out to anything from The Clash to Lady Gaga.

1 Comment

  1. […] has a snippet to let you hide WooCommerce product reviews from customers unless they’ve purchased the product (which is helpful if you don’t have […]

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Error: Please enter a valid email address

Error: Invalid email

Error: Please enter your first name

Error: Please enter your last name

Error: Please enter a username

Error: Please enter a password

Error: Please confirm your password

Error: Password and password confirmation do not match