Helper method to retrieve review verification status from comment meta, generating it on the fly for existing reviews.
This commit is contained in:
parent
e9bfa2553c
commit
1b370bb64a
|
@ -548,3 +548,19 @@ function wc_reset_order_customer_id_on_deleted_user( $user_id ) {
|
|||
}
|
||||
|
||||
add_action( 'deleted_user', 'wc_reset_order_customer_id_on_deleted_user' );
|
||||
|
||||
/**
|
||||
* Get review verification status.
|
||||
* @param int $comment_id
|
||||
* @return bool
|
||||
*/
|
||||
function wc_review_is_from_verified_owner( $comment_id ) {
|
||||
$verified = get_comment_meta( $comment_id, 'verified', true );
|
||||
|
||||
// If no "verified" meta is present, generate it (if this is a product review).
|
||||
if ( '' === $verified ) {
|
||||
$verified = WC_Comments::add_comment_purchase_verification( $comment_id );
|
||||
}
|
||||
|
||||
return (bool) $verified;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue