WC_Tax::get_rate_percent_value()public staticWC 1.0

Return a given rates percent.

Method of the class: WC_Tax{}

No Hooks.

Return

float.

Usage

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

WC_Tax::get_rate_percent_value() code WC 9.4.2

public static function get_rate_percent_value( $key_or_rate ) {
	global $wpdb;

	if ( is_object( $key_or_rate ) ) {
		$tax_rate = $key_or_rate->tax_rate;
	} else {
		$key      = $key_or_rate;
		$tax_rate = $wpdb->get_var( $wpdb->prepare( "SELECT tax_rate FROM {$wpdb->prefix}woocommerce_tax_rates WHERE tax_rate_id = %s", $key ) );
	}

	return floatval( $tax_rate );
}