WC_Tax::get_rate_label()public staticWC 1.0

Return a given rates label.

Method of the class: WC_Tax{}

Hooks from the method

Return

String.

Usage

$result = WC_Tax::get_rate_label( $key_or_rate );
$key_or_rate(mixed) (required)
Tax rate ID, or the db row itself in object format.

WC_Tax::get_rate_label() code WC 9.5.1

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 );
}