Created
July 14, 2016 17:30
-
-
Save WooForce/143f20b7085c80952db9aca274388e8a to your computer and use it in GitHub Desktop.
Set minimum shipping rate for a shipping method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('woocommerce_package_rates', 'wf_ups_min_rate', 10, 2); | |
function wf_ups_min_rate($available_rates, $package) | |
{ | |
$min_shipping_rate = 10; | |
foreach($available_rates as $rate_key => $rate){ | |
if($rate->method_id == 'wf_shipping_ups' && $rate->cost<$min_shipping_rate){ | |
$available_rates[$rate_key]->cost = $min_shipping_rate; | |
} | |
} | |
return $available_rates; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment