parent
83f1236875
commit
3670afdffb
|
@ -115,6 +115,24 @@ class WC_Order {
|
|||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the user ID associated with the order. Guests are 0.
|
||||
* @since 2.2
|
||||
* @return int|false
|
||||
*/
|
||||
public function get_user_id() {
|
||||
return $this->customer_user ? $this->customer_user : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user associated with the order. False for guests.
|
||||
* @since 2.2
|
||||
* @return WP_User|false
|
||||
*/
|
||||
public function get_user() {
|
||||
return $user_id = $this->get_user_id() ? get_user_by( 'id', $user_id ) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an order key is valid.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue