woocommerce_package_rates
Filter the calculated shipping rates.
Использование
add_filter( 'woocommerce_package_rates', 'wp_kama_woocommerce_package_rates_filter', 10, 2 ); /** * Function for `woocommerce_package_rates` filter-hook. * * @param array $package['rates'] Package rates. * @param array $package Package of cart items. * * @return array */ function wp_kama_woocommerce_package_rates_filter( $package['rates'], $package ){ // filter... return $package['rates']; }
- $package['rates'](массив)
- Package rates.
- $package(массив)
- Package of cart items.
Где вызывается хук
woocommerce_package_rates
woocommerce/includes/class-wc-shipping.php 368
$package['rates'] = apply_filters( 'woocommerce_package_rates', $package['rates'], $package );