Woocommerce have many shipping methods. If you want to select the cheapest shipping method for your customer then add the below given code in your functions.php
add_filter( 'woocommerce_package_rates' , 'cheapest_woocommerce_shipping_method', 10, 2 );
function cheapest_woocommerce_shipping_method( $rates, $package ) {
if ( ! $rates ) {
return;
}
$prices = array();
foreach( $rates as $rate ) {
$prices[] = $rate->cost;
}
array_multisort( $prices, $rates );
return $rates;
}
(Visited 526 times, 1 visits today)





