WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

WC_REST_Customers_V1_Controller::update_item() public WC 1.0

Update a single user.

{} Это метод класса: WC_REST_Customers_V1_Controller{}

Хуки из метода
Возвращает

WP_Error/WP_REST_Response.

Использование

$WC_REST_Customers_V1_Controller = new WC_REST_Customers_V1_Controller();
$WC_REST_Customers_V1_Controller->update_item( $request );
$request(WP_REST_Request) (обязательный)
Full details about the request.

Код WC_REST_Customers_V1_Controller::update_item() WC 4.7.1

<?php
public function update_item( $request ) {
	try {
		$id       = (int) $request['id'];
		$customer = new WC_Customer( $id );

		if ( ! $customer->get_id() ) {
			throw new WC_REST_Exception( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), 400 );
		}

		if ( ! empty( $request['email'] ) && email_exists( $request['email'] ) && $request['email'] !== $customer->get_email() ) {
			throw new WC_REST_Exception( 'woocommerce_rest_customer_invalid_email', __( 'Email address is invalid.', 'woocommerce' ), 400 );
		}

		if ( ! empty( $request['username'] ) && $request['username'] !== $customer->get_username() ) {
			throw new WC_REST_Exception( 'woocommerce_rest_customer_invalid_argument', __( "Username isn't editable.", 'woocommerce' ), 400 );
		}

		// Customer email.
		if ( isset( $request['email'] ) ) {
			$customer->set_email( sanitize_email( $request['email'] ) );
		}

		// Customer password.
		if ( isset( $request['password'] ) ) {
			$customer->set_password( $request['password'] );
		}

		$this->update_customer_meta_fields( $customer, $request );
		$customer->save();

		$user_data = get_userdata( $customer->get_id() );
		$this->update_additional_fields_for_object( $user_data, $request );

		if ( ! is_user_member_of_blog( $user_data->ID ) ) {
			$user_data->add_role( 'customer' );
		}

		/**
		 * Fires after a customer is created or updated via the REST API.
		 *
		 * @param WP_User         $customer  Data used to create the customer.
		 * @param WP_REST_Request $request   Request object.
		 * @param boolean         $creating  True when creating customer, false when updating customer.
		 */
		do_action( 'woocommerce_rest_insert_customer', $user_data, $request, false );

		$request->set_param( 'context', 'edit' );
		$response = $this->prepare_item_for_response( $user_data, $request );
		$response = rest_ensure_response( $response );
		return $response;
	} catch ( Exception $e ) {
		return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
	}
}