WC_Tax::get_rate_label( mixed $key_or_rate )
Return a given rates label.
Description Description
Parameters Parameters
- $key_or_rate
-
(Required) Tax rate ID, or the db row itself in object format.
Return Return
(string)
Source Source
File: includes/class-wc-tax.php
public static function get_rate_label( $key_or_rate ) { global $wpdb; if ( is_object( $key_or_rate ) ) { $key = $key_or_rate->tax_rate_id; $rate_name = $key_or_rate->tax_rate_name; } else { $key = $key_or_rate; $rate_name = $wpdb->get_var( $wpdb->prepare( "SELECT tax_rate_name FROM {$wpdb->prefix}woocommerce_tax_rates WHERE tax_rate_id = %s", $key ) ); } if ( ! $rate_name ) { $rate_name = WC()->countries->tax_or_vat(); } return apply_filters( 'woocommerce_rate_label', $rate_name, $key ); }