Customers report endpoint: only include customer link if they’re a registered user.
This commit is contained in:
parent
fc20d2bb1b
commit
dd87522a5e
|
@ -141,14 +141,15 @@ class WC_Admin_REST_Reports_Customers_Controller extends WC_REST_Reports_Control
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function prepare_links( $object ) {
|
protected function prepare_links( $object ) {
|
||||||
$links = array(
|
if ( empty( $object['user_id'] ) ) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
'customer' => array(
|
'customer' => array(
|
||||||
// TODO: is this meant to be a core WC link?
|
'href' => rest_url( sprintf( '/%s/customers/%d', $this->namespace, $object['user_id'] ) ),
|
||||||
'href' => rest_url( sprintf( '/%s/customers/%d', $this->namespace, $object['customer_id'] ) ),
|
|
||||||
),
|
),
|
||||||
// TODO: add user link?
|
|
||||||
);
|
);
|
||||||
return $links;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue