wc_meta_update_last_update_time()WC 2.6.0

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

Hooks from the function

Return

null. Nothing (null).

Usage

wc_meta_update_last_update_time( $meta_id, $user_id, $meta_key, $_meta_value );
$meta_id(int) (required)
ID of the meta object that was changed.
$user_id(int) (required)
The user that was updated.
$meta_key(string) (required)
Name of the meta key that was changed.
$_meta_value(mixed) (required)
Value of the meta that was changed.

Changelog

Since 2.6.0 Introduced.

wc_meta_update_last_update_time() code WC 8.6.1

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 );
	}
}