WC_Tax::get_rates( string $tax_class = '', object $customer = null )
Get’s an array of matching rates for a tax class.
Description Description
Parameters Parameters
- $tax_class
-
(Optional) Tax class to get rates for.
Default value: ''
- $customer
-
(Optional) Override the customer object to get their location.
Default value: null
Return Return
(array)
Source Source
File: includes/class-wc-tax.php
public static function get_rates( $tax_class = '', $customer = null ) {
$tax_class = sanitize_title( $tax_class );
$location = self::get_tax_location( $tax_class, $customer );
$matched_tax_rates = array();
if ( count( $location ) === 4 ) {
list( $country, $state, $postcode, $city ) = $location;
$matched_tax_rates = self::find_rates(
array(
'country' => $country,
'state' => $state,
'postcode' => $postcode,
'city' => $city,
'tax_class' => $tax_class,
)
);
}
return apply_filters( 'woocommerce_matched_rates', $matched_tax_rates, $tax_class, $customer );
}