WC_Tax::find_rates( array $args = array() )
Searches for all matching country/state/postcode tax rates.
Description Description
Parameters Parameters
- $args
-
(Optional) Args that determine the rate to find.
Default value: array()
Return Return
(array)
Source Source
File: includes/class-wc-tax.php
public static function find_rates( $args = array() ) { $args = wp_parse_args( $args, array( 'country' => '', 'state' => '', 'city' => '', 'postcode' => '', 'tax_class' => '', ) ); $country = $args['country']; $state = $args['state']; $city = $args['city']; $postcode = wc_normalize_postcode( wc_clean( $args['postcode'] ) ); $tax_class = $args['tax_class']; if ( ! $country ) { return array(); } $cache_key = WC_Cache_Helper::get_cache_prefix( 'taxes' ) . 'wc_tax_rates_' . md5( sprintf( '%s+%s+%s+%s+%s', $country, $state, $city, $postcode, $tax_class ) ); $matched_tax_rates = wp_cache_get( $cache_key, 'taxes' ); if ( false === $matched_tax_rates ) { $matched_tax_rates = self::get_matched_tax_rates( $country, $state, $postcode, $city, $tax_class ); wp_cache_set( $cache_key, $matched_tax_rates, 'taxes' ); } return apply_filters( 'woocommerce_find_rates', $matched_tax_rates, $args ); }