WC_Tax::get_rates_from_location()
Get's an array of matching rates from location and tax class. $customer parameter is used to preserve backward compatibility for filter.
Метод класса: WC_Tax{}
Хуки из метода
Возвращает
Разное|null
. Tax rates.
Использование
$result = WC_Tax::get_rates_from_location( $tax_class, $location, $customer );
- $tax_class(строка) (обязательный)
- Tax class to get rates for.
- $location(массив) (обязательный)
- Location to compute rates for. Should be in form: array( country, state, postcode, city).
- $customer(объект)
- Only used to maintain backward compatibility for filter woocommerce-matched_rates.
По умолчанию: null
Код WC_Tax::get_rates_from_location() WC Tax::get rates from location WC 8.7.0
public static function get_rates_from_location( $tax_class, $location, $customer = null ) { $tax_class = sanitize_title( $tax_class ); $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 ); }