autoship_refresh_customer_metrics_for_user (function)
(src/customers.php)Handles refreshing customer metrics data for a user. It takes the Wordpress $user as its parameter.
Code
/** * Refresh the customer metrics for a User. * * @param int $user_id The customers id */ function autoship_refresh_customer_metrics_for_user( $user_id ){ $results = autoship_available_customer_metrics( array( 'page' => 1, 'pageSize' => 1, 'customerIds' => $user_id ) ); if ( !is_wp_error( $results ) && !empty( $results->data ) ){ foreach ( $results->data as $metrics_data ) autoship_save_customer_metrics_data( $user_id, $metrics_data, true ); do_action( 'autoship_customer_user_metrics_refreshed', $user_id, $results->data ); } }