Site icon Hip-Hop Website Design and Development

woocommerce_package_rates not fired everytime

I am using woocommerce_package_rates hook on woocommerce so I could change the flat rate on checkout page, but the problem is when someone access the checkout page its not triggering everytime.

This triggers sometimes but not all the time.

add_filter( 'woocommerce_package_rates', 'custom_shipping_costs', 20, 2 );
function custom_shipping_costs( $rates, $package ) {
echo "Hello "; exit;

}

Any idea for the same ?