woocommerce_shipping_tax_class
Filters the shipping tax class before calculating tax rates.
This filter allows plugins to modify or replace the shipping tax class that will be used to calculate shipping tax rates. It fires after core logic determines the tax class but before rates are looked up.
Использование
add_filter( 'woocommerce_shipping_tax_class', 'wp_kama_woocommerce_shipping_tax_class_filter', 10, 4 );
/**
* Function for `woocommerce_shipping_tax_class` filter-hook.
*
* @param string|null $tax_class The tax class determined by core logic. Can be null, empty
* string (standard), or a tax class slug.
* @param WC_Cart|null $cart The cart object containing all cart items, or null if not
* available.
* @param WC_Customer|null $customer The customer object, or null if not available.
* @param array $location The tax location array [country, state, postcode, city].
*
* @return string|null
*/
function wp_kama_woocommerce_shipping_tax_class_filter( $tax_class, $cart, $customer, $location ){
// filter...
return $tax_class;
}
- $tax_class(строка|null)
- The tax class determined by core logic. Can be null, empty string (standard), or a tax class slug.
- $cart(WC_Cart|null)
- The cart object containing all cart items, or null if not available.
- $customer(WC_Customer|null)
- The customer object, or null if not available.
- $location(массив)
- The tax location array [country, state, postcode, city].
Список изменений
| С версии 10.5.0 | Введена. |
Где вызывается хук
woocommerce_shipping_tax_class
woocommerce/includes/class-wc-tax.php 619
$tax_class = apply_filters( 'woocommerce_shipping_tax_class', $tax_class, $cart, $customer, $location );