wc_meta_update_last_update_time( int $meta_id, int $user_id, string $meta_key, string $_meta_value )

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


Description Description


Parameters Parameters

$meta_id

(Required) ID of the meta object that was changed.

$user_id

(Required) The user that was updated.

$meta_key

(Required) Name of the meta key that was changed.

$_meta_value

(Required) Value of the meta that was changed.


Top ↑

Source Source

File: includes/wc-user-functions.php

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

Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.