woocommerce_before_get_rates_for_package action-hookWC 4.3.0

Fires before getting shipping rates for a package.

Usage

add_action( 'woocommerce_before_get_rates_for_package', 'wp_kama_woocommerce_before_get_rates_for_package_action', 10, 2 );

/**
 * Function for `woocommerce_before_get_rates_for_package` action-hook.
 * 
 * @param array              $package         Package of cart items.
 * @param WC_Shipping_Method $shipping_method Shipping method instance.
 *
 * @return void
 */
function wp_kama_woocommerce_before_get_rates_for_package_action( $package, $shipping_method ){

	// action...
}
$package(array)
Package of cart items.
$shipping_method(WC_Shipping_Method)
Shipping method instance.

Changelog

Since 4.3.0 Introduced.

Where the hook is called

WC_Shipping::calculate_shipping_for_package()
woocommerce_before_get_rates_for_package
woocommerce/includes/class-wc-shipping.php 345
do_action( 'woocommerce_before_get_rates_for_package', $package, $shipping_method );

Where the hook is used in WooCommerce

Usage not found.