Created
September 20, 2024 08:01
-
-
Save xlplugins/6b69a7b5d1acfdcd4abec44ba68df45b to your computer and use it in GitHub Desktop.
HIde free shipping for Recurring cart At funnelkit checkout
This file contains 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', 'remove_free_shipping_for_recurring_cart', 10, 2); | |
function remove_free_shipping_for_recurring_cart($rates, $package) { | |
// Check if it's a recurring cart | |
if (isset($package['recurring_cart_key'])) { | |
// Loop through the rates | |
foreach ($rates as $rate_id => $rate) { | |
// Check if the rate is for free shipping | |
if ('free_shipping' === $rate->method_id) { | |
// Unset the free shipping rate | |
unset($rates[$rate_id]); | |
} | |
} | |
} | |
return $rates; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment