Order by name and fix return value

This commit is contained in:
Mike Jolley 2019-03-20 15:27:53 +00:00
parent f113d26e44
commit db3b486442
1 changed files with 5 additions and 3 deletions

View File

@ -724,7 +724,7 @@ class WC_Tax {
if ( ! is_array( $tax_rate_classes ) ) { if ( ! is_array( $tax_rate_classes ) ) {
$tax_rate_classes = $wpdb->get_results( $tax_rate_classes = $wpdb->get_results(
" "
SELECT * FROM {$wpdb->wc_tax_rate_classes}; SELECT * FROM {$wpdb->wc_tax_rate_classes} ORDER BY name;
" "
); );
wp_cache_set( $cache_key, $tax_rate_classes, 'taxes' ); wp_cache_set( $cache_key, $tax_rate_classes, 'taxes' );
@ -826,9 +826,11 @@ class WC_Tax {
return false; return false;
} }
$tax_class = current( $matches );
return array( return array(
'name' => $matches[0]->name, 'name' => $tax_class->name,
'slug' => $matches[0]->slug, 'slug' => $tax_class->slug,
); );
} }