wc_meta_update_last_update_time()WC 2.6.0

Hooks into the update user meta function to set the user last updated timestamp.

Хуки из функции

Возвращает

null. Ничего (null).

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

wc_meta_update_last_update_time( $meta_id, $user_id, $meta_key, $_meta_value );
$meta_id(int) (обязательный)
ID of the meta object that was changed.
$user_id(int) (обязательный)
The user that was updated.
$meta_key(строка) (обязательный)
Name of the meta key that was changed.
$_meta_value(разное) (обязательный)
Value of the meta that was changed.

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

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

Код wc_meta_update_last_update_time() WC 8.7.0

function wc_meta_update_last_update_time( $meta_id, $user_id, $meta_key, $_meta_value ) {
	$keys_to_track = apply_filters( 'woocommerce_user_last_update_fields', array( 'first_name', 'last_name' ) );

	$update_time = in_array( $meta_key, $keys_to_track, true ) ? true : false;
	$update_time = 'billing_' === substr( $meta_key, 0, 8 ) ? true : $update_time;
	$update_time = 'shipping_' === substr( $meta_key, 0, 9 ) ? true : $update_time;

	if ( $update_time ) {
		wc_set_user_last_update_time( $user_id );
	}
}