WC_Tax::get_rate_percent_value()
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() 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 ); }