Add a product review with ratings programmatically in Woocommerce
The title says it all. I know the reviews are the native comments post type in Wordpress. I have included the code to add a comment. The problem is however I am unclear how to give the comment a rating and how to tie it to a particular product. When I use the comment_post_ID it does not seem to be assigning the comment (review) to the correct post. $time = current_time('mysql'); $data = array( 'comment_post_ID' => 1, 'comment_author' => 'admin', 'comment_author_email' => 'admin@admin.com', 'comment_author_url' => 'http://', 'comment_content' => 'content here', 'comment_type' => '', 'comment