Added is_paying_customer() to easily check if a user is a WC customer:
Usage: ` $customer = new WC_Customer(); $out = 'Paying customer ? '; if( $customer->is_paying_customer( 10 ) ) { $out .= "yes"; } else { $out .= "no"; } echo $out; `
This commit is contained in:
parent
342737907a
commit
94c93800b4
|
@ -188,6 +188,22 @@ class WC_Customer {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the user a paying customer?
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function is_paying_customer( $user_id ) {
|
||||||
|
|
||||||
|
$paying_customer = get_user_meta( $user_id, 'paying_customer', true );
|
||||||
|
if( $paying_customer != '' && absint( $paying_customer ) > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue