prefix}wc_order_tax_lookup otl JOIN {$wpdb->prefix}wc_order_stats os ON os.order_id = otl.order_id JOIN {$wpdb->prefix}woocommerce_tax_rates tr ON tr.tax_rate_id = otl.tax_rate_id $sql_where GROUP BY otl.tax_rate_id ORDER BY tax_amount DESC"; // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter $results = $wpdb->get_results( $query, ARRAY_A ); return array( 'table' => $results, 'chart' => array( 'labels' => array(), // Tax optionally doesn't need charts, just list 'revenue' => array(), ) ); } }