WC_Tax::is_compound( mixed $key_or_rate )

Return true/false depending on if a rate is a compound rate.


Description Description


Parameters Parameters

$key_or_rate

(Required) Tax rate ID, or the db row itself in object format.


Top ↑

Return Return

(bool)


Top ↑

Source Source

File: includes/class-wc-tax.php

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

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

		return (bool) apply_filters( 'woocommerce_rate_compound', $compound, $key );
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.