Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
same as in WordPress
WooCommerce reviews are trivial comments.
Accordingly
When adding a comment
add_action('wp_insert_comment', 'wpp_comment_inserted', 99, 2);
function wpp_comment_inserted($comment_id, $comment_object) {
//$comment_object - объект комментария,
//получаете пост на который он оставлен
// и если это продукт отправляете письмо
}
add_action('transition_comment_status', 'wpp_comment_approve', 10, 3);
function wpp_comment_approve($new_status, $old_status, $comment_object) {
if( $old_status !== $new_status && $new_status === 'approved' ) {
//$comment_object - объект комментария,
//получаете пост на который он оставлен
// и если это продукт отправляете письмо
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question