WC_Comments::add_comment_purchase_verification( int $comment_id )

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


Description Description


Parameters Parameters

$comment_id

(Required) Comment ID.


Top ↑

Return Return

(bool)


Top ↑

Source Source

File: includes/class-wc-comments.php

	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;
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.