From a939cacf5ca34cbccb2b2e6de7f735b55c1cade5 Mon Sep 17 00:00:00 2001 From: Hayden Whiteman Date: Sat, 22 Aug 2020 22:09:14 +1200 Subject: [PATCH] Fix #27339 --- includes/class-wc-tax.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/class-wc-tax.php b/includes/class-wc-tax.php index 70a34ab6c0c..5f4aa1c8ba3 100644 --- a/includes/class-wc-tax.php +++ b/includes/class-wc-tax.php @@ -1189,8 +1189,10 @@ class WC_Tax { public static function get_rates_for_tax_class( $tax_class ) { global $wpdb; + $tax_class = self::format_tax_rate_class( $tax_class ); + // Get all the rates and locations. Snagging all at once should significantly cut down on the number of queries. - $rates = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM `{$wpdb->prefix}woocommerce_tax_rates` WHERE `tax_rate_class` = %s;", sanitize_title( $tax_class ) ) ); + $rates = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM `{$wpdb->prefix}woocommerce_tax_rates` WHERE `tax_rate_class` = %s;", $tax_class ) ); $locations = $wpdb->get_results( "SELECT * FROM `{$wpdb->prefix}woocommerce_tax_rate_locations`" ); if ( ! empty( $rates ) ) {