get_data(); try { $customer = new WC_Customer( $user_data->ID ); $filtered_meta_data = array_filter( $customer->get_meta_data(), static function ( $meta ) { return ! is_protected_meta( $meta->key, 'user' ); } ); // Convert to the WC REST API expected format. $data['meta_data'] = array_map( static function ( $meta ) { return array( 'id' => $meta->id, 'key' => $meta->key, 'value' => $meta->value, ); }, array_values( $filtered_meta_data ) ); } catch ( Exception $e ) { Logger::log( 'Error getting customer meta data: ' . $e->getMessage() ); } // Structured tax_ids list (read fallback across legacy plugin meta keys). $data['tax_ids'] = ( new Tax_Id_Reader() )->read_for_user( $user_data->ID ); $response->set_data( $data ); return $response; } }