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

WC_Customer_Data_Store::update_user_meta() private WC 3.0.0

Helper method that updates all the meta for a customer. Used for update & create.

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

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

null. Ничего.

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

// private - только в коде основоного (родительского) класса
$result = $this->update_user_meta( $customer );
$customer(WC_Customer) (обязательный)
Customer object.

Список изменений

С версии 3.0.0 Введена.

Код WC_Customer_Data_Store::update_user_meta() WC 5.2.2

<?php
private function update_user_meta( $customer ) {
	$updated_props = array();
	$changed_props = $customer->get_changes();

	$meta_key_to_props = array(
		'paying_customer' => 'is_paying_customer',
		'first_name'      => 'first_name',
		'last_name'       => 'last_name',
	);

	foreach ( $meta_key_to_props as $meta_key => $prop ) {
		if ( ! array_key_exists( $prop, $changed_props ) ) {
			continue;
		}

		if ( update_user_meta( $customer->get_id(), $meta_key, $customer->{"get_$prop"}( 'edit' ) ) ) {
			$updated_props[] = $prop;
		}
	}

	$billing_address_props = array(
		'billing_first_name' => 'billing_first_name',
		'billing_last_name'  => 'billing_last_name',
		'billing_company'    => 'billing_company',
		'billing_address_1'  => 'billing_address_1',
		'billing_address_2'  => 'billing_address_2',
		'billing_city'       => 'billing_city',
		'billing_state'      => 'billing_state',
		'billing_postcode'   => 'billing_postcode',
		'billing_country'    => 'billing_country',
		'billing_email'      => 'billing_email',
		'billing_phone'      => 'billing_phone',
	);

	foreach ( $billing_address_props as $meta_key => $prop ) {
		$prop_key = substr( $prop, 8 );

		if ( ! isset( $changed_props['billing'] ) || ! array_key_exists( $prop_key, $changed_props['billing'] ) ) {
			continue;
		}

		if ( update_user_meta( $customer->get_id(), $meta_key, $customer->{"get_$prop"}( 'edit' ) ) ) {
			$updated_props[] = $prop;
		}
	}

	$shipping_address_props = array(
		'shipping_first_name' => 'shipping_first_name',
		'shipping_last_name'  => 'shipping_last_name',
		'shipping_company'    => 'shipping_company',
		'shipping_address_1'  => 'shipping_address_1',
		'shipping_address_2'  => 'shipping_address_2',
		'shipping_city'       => 'shipping_city',
		'shipping_state'      => 'shipping_state',
		'shipping_postcode'   => 'shipping_postcode',
		'shipping_country'    => 'shipping_country',
	);

	foreach ( $shipping_address_props as $meta_key => $prop ) {
		$prop_key = substr( $prop, 9 );

		if ( ! isset( $changed_props['shipping'] ) || ! array_key_exists( $prop_key, $changed_props['shipping'] ) ) {
			continue;
		}

		if ( update_user_meta( $customer->get_id(), $meta_key, $customer->{"get_$prop"}( 'edit' ) ) ) {
			$updated_props[] = $prop;
		}
	}

	do_action( 'woocommerce_customer_object_updated_props', $customer, $updated_props );
}