WordPress is the most popular CMS. WooCommerce plugin is used sell items online on an WordPress website. WooCommerce does not impose any limit for customers to review on orders. If you have set only verified customers can review on products. Then it allows the customers to post review as many times as they wants after buying a product. How can you limit a customer to leave review once only on a product. Here is the solution for it.

For this solution, we will made modifications in active theme’s folder. For this I assume that you have installed child theme for active theme, so the modifications may not be deleted upon theme update. Here is the guide how you can install child theme for on your WordPress. Now let us go to the solution. How to limit WooCommerce customers to limit review only once per product.

  1. By using cPanel or FTP go to the ‘wp-content’ folder then ‘plugins’ folder then go to the ‘woocommerce’ plugin folder.
  2. And there go to the ‘templates’ folder and copy or download the file ‘single-product-reviews.php’.
  3. Now go back to ‘wp-content’ directory again, then go to ‘themes’ folder and then go to your child theme folder.
  4. Create a new folder in the child theme and name it ‘woocommerce’
  5. Now paste/upload the file ‘single-product-reviews.php’ in the newly created folder. It will override the original file in the WooCommerce plugin.
  6. Now, its time to edit the newly created file to limit the reviews on a product.
  7. Just locate the variable
  8. Now paste the following lines of code, below the global variable.
    Copy to Clipboard
  9. Here current user is the current logged in user. We are getting reviews made by current user through get comments function by passing arguments of user Id and product id. If user had left any reviews, then all his reviews will be assigned to variable user comments in the form of  an array. But if he has not left any reviews on that product. then the user comments variable will be empty or null. and we will use that trick to hide review form from the user, who had already left reviews.
  10. Now let us go to the form creation code and create, an if condition there to render the form, only if a user didn’t left any review. Like below:
    Copy to Clipboard
    we have used negation of user comments variable in if condition, to allow form rendering if user comments variable is empty.
  11. Now let us go to the end of form code, and close our if condition brackets, so the  whole form will be inside if condition.
    Copy to Clipboard
  12. Save the file.

And now, we are good to go. The review form will not appear for the customer, who had already reviewed the product. Below YouTube video also explains the whole process to limit customer review only once on a product after ordering.