WC_Comments::add_comment_purchase_verification()public staticWC 1.0

Determine if a review is from a verified owner at submission.

Метод класса: WC_Comments{}

Хуков нет.

Возвращает

true|false.

Использование

$result = WC_Comments::add_comment_purchase_verification( $comment_id );
$comment_id(int) (обязательный)
Comment ID.

Код WC_Comments::add_comment_purchase_verification() WC 8.6.1

public static function add_comment_purchase_verification( $comment_id ) {
	$comment  = get_comment( $comment_id );
	$verified = false;
	if ( 'product' === get_post_type( $comment->comment_post_ID ) ) {
		$verified = wc_customer_bought_product( $comment->comment_author_email, $comment->user_id, $comment->comment_post_ID );
		add_comment_meta( $comment_id, 'verified', (int) $verified, true );
	}
	return $verified;
}