Update product rating counts after adding a rating

This commit is contained in:
Claudiu Lodromanean 2017-03-29 14:51:33 -07:00
parent bbd54cc15f
commit 38cd9b4df7
1 changed files with 5 additions and 0 deletions

View File

@ -205,6 +205,11 @@ class WC_Comments {
return;
}
add_comment_meta( $comment_id, 'rating', (int) esc_attr( $_POST['rating'] ), true );
$post_id = isset( $_POST['comment_post_ID'] ) ? (int) $_POST['comment_post_ID'] : 0;
if ( $post_id ) {
self::clear_transients( $post_id );
}
}
}