Product reviews are held in the wp_comments table with all the other comments and in the case of Woocommerce the order status updates.
To export the product reviews we need to exclude the comment_author ‘WooCommerce’ and join to the wp_posts to return the product title (or any other comments made on other post for that matter).
SELECT `post_title` AS Product, `comment_author` AS 'Customer Name', `comment_author_email` AS 'Customer Email', `comment_date` , `comment_content` AS 'Comment' FROM `wp_comments` INNER JOIN `wp_posts` ON `comment_post_ID`=`ID` WHERE `comment_author` != 'WooCommerce' AND `comment_approved` = '1' ORDER BY `wp_comments`.`comment_date` DESC
Hi there, many thanks for this – I’ve enhanced the SQL file here: https://gist.github.com/wecreatedigital/f52c2c8a897276d13a72c6bb2bdccb0e to include the rating and to filter out other comments which I was getting from other plugins. I thought it might be helpful to share!
Thanks, it works!
Hello thanks for sharing it.
It worked for me…can I import then the exported reviews into another DB by pasting the SQL?
Glad it worked for you 🙂
You could insert the reviews into another DB but not by pasting the SQL. You would need to write an insert statement. A good starting point would be https://www.w3schools.com/sql/sql_insert.asp