woocommerce_shipping_chosen_method filter-hookWC 3.2.0

Filters the default shipping method for a package.

Usage

add_filter( 'woocommerce_shipping_chosen_method', 'wp_kama_woocommerce_shipping_chosen_method_filter', 10, 3 );

/**
 * Function for `woocommerce_shipping_chosen_method` filter-hook.
 * 
 * @param string $default       Default shipping method.
 * @param array  $rates         Shipping rates.
 * @param string $chosen_method Chosen method id.
 *
 * @return string
 */
function wp_kama_woocommerce_shipping_chosen_method_filter( $default, $rates, $chosen_method ){

	// filter...
	return $default;
}
$default(string)
Default shipping method.
$rates(array)
Shipping rates.
$chosen_method(string)
Chosen method id.

Changelog

Since 3.2.0 Introduced.

Where the hook is called

wc_get_default_shipping_method_for_package()
woocommerce_shipping_chosen_method
woocommerce/includes/wc-cart-functions.php 499
return (string) apply_filters( 'woocommerce_shipping_chosen_method', $default, $package['rates'], $chosen_method );

Where the hook is used in WooCommerce

Usage not found.