woocommerce_admin_get_user_data_fields хук-фильтрWC 1.0

We store some WooCommerce specific user meta attached to users endpoint, so that we can track certain preferences or values such as the inbox activity panel last open time. Additional fields can be added in the function below, and then used via wc-admin's currentUser data.

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

add_filter( 'woocommerce_admin_get_user_data_fields', 'wp_kama_woocommerce_admin_get_user_data_fields_filter' );

/**
 * Function for `woocommerce_admin_get_user_data_fields` filter-hook.
 * 
 * @param  $array 
 *
 * @return 
 */
function wp_kama_woocommerce_admin_get_user_data_fields_filter( $array ){

	// filter...
	return $array;
}
$array
-

Где вызывается хук

WCAdminUser::get_user_data_fields()
woocommerce_admin_get_user_data_fields
woocommerce/src/Internal/Admin/WCAdminUser.php 106
return apply_filters( 'woocommerce_admin_get_user_data_fields', array() );

Где используется хук в WooCommerce

woocommerce/src/Internal/Admin/ActivityPanels.php 35
add_filter( 'woocommerce_admin_get_user_data_fields', array( $this, 'add_user_data_fields' ) );
woocommerce/src/Internal/Admin/Analytics.php 61
add_filter( 'woocommerce_admin_get_user_data_fields', array( $this, 'add_user_data_fields' ) );
woocommerce/src/Internal/Admin/Homescreen.php 41
add_filter( 'woocommerce_admin_get_user_data_fields', array( $this, 'add_user_data_fields' ) );
woocommerce/src/Internal/Admin/MobileAppBanner.php 32
add_filter( 'woocommerce_admin_get_user_data_fields', array( $this, 'add_user_data_fields' ) );