mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-05-03 12:12:25 +08:00
https://www.businessbloomer.com/woocommerce-show-rating-woocommerce-product-review-admin-email/
10 lines
533 B
Text
10 lines
533 B
Text
add_filter( 'comment_moderation_text', 'bbloomer_add_stars_woocommerce_moderate_comment_email', 9999, 2 );
|
|
|
|
function bbloomer_add_stars_woocommerce_moderate_comment_email( $notify_message, $comment_id ) {
|
|
$review = get_comment( $comment_id );
|
|
if ( $review && 'product' === get_post_type( $review->comment_post_ID ) ) {
|
|
$rating = intval( get_comment_meta( $comment_id, 'rating', true ) );
|
|
$notify_message .= "\r\n" . sprintf( 'Product review rating: %s / 5', $rating ) . "\r\n";
|
|
}
|
|
return $notify_message;
|
|
}
|