Removed functions unchanged vs v2.
This commit is contained in:
parent
2ae09ce1ce
commit
3b91c765e5
|
@ -62,51 +62,6 @@ class WC_REST_Customers_Controller extends WC_REST_Customers_V2_Controller {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare a single customer output for response.
|
||||
*
|
||||
* @param WP_User $user_data User object.
|
||||
* @param WP_REST_Request $request Request object.
|
||||
* @return WP_REST_Response $response Response data.
|
||||
*/
|
||||
public function prepare_item_for_response( $user_data, $request ) {
|
||||
$customer = new WC_Customer( $user_data->ID );
|
||||
$data = $this->get_formatted_item_data( $customer );
|
||||
$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
|
||||
$data = $this->add_additional_fields_to_object( $data, $request );
|
||||
$data = $this->filter_response_by_context( $data, $context );
|
||||
$response = rest_ensure_response( $data );
|
||||
$response->add_links( $this->prepare_links( $user_data ) );
|
||||
|
||||
/**
|
||||
* Filter customer data returned from the REST API.
|
||||
*
|
||||
* @param WP_REST_Response $response The response object.
|
||||
* @param WP_User $user_data User object used to create response.
|
||||
* @param WP_REST_Request $request Request object.
|
||||
*/
|
||||
return apply_filters( 'woocommerce_rest_prepare_customer', $response, $user_data, $request );
|
||||
}
|
||||
|
||||
/**
|
||||
* Update customer meta fields.
|
||||
*
|
||||
* @param WC_Customer $customer Customer data.
|
||||
* @param WP_REST_Request $request Request data.
|
||||
*/
|
||||
protected function update_customer_meta_fields( $customer, $request ) {
|
||||
parent::update_customer_meta_fields( $customer, $request );
|
||||
|
||||
// Meta data.
|
||||
if ( isset( $request['meta_data'] ) ) {
|
||||
if ( is_array( $request['meta_data'] ) ) {
|
||||
foreach ( $request['meta_data'] as $meta ) {
|
||||
$customer->update_meta_data( $meta['key'], $meta['value'], isset( $meta['id'] ) ? $meta['id'] : '' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Customer's schema, conforming to JSON Schema.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue