Last active
March 31, 2016 12:01
-
-
Save WooForce/336cdf9eddc0381da0a9 to your computer and use it in GitHub Desktop.
WooCommerce: If you are using Calculation Mode as Per Item/Per Category/Per Shipping and would like to offer a free shipping based on order value.
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_remove_shipping_pro_rate_when_free_shipping_is_applicable', 10, 2); | |
function wf_remove_shipping_pro_rate_when_free_shipping_is_applicable($rates, $package) | |
{ | |
if (isset($rates['free_shipping'])) { | |
foreach($rates as $ratekey => $ratevalue) { | |
if (strpos($ratekey, 'wf_woocommerce_shipping_pro:') !== false) { | |
unset($rates[$ratekey]); | |
} | |
} | |
} | |
return $rates; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment