Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xlplugins/6b69a7b5d1acfdcd4abec44ba68df45b to your computer and use it in GitHub Desktop.
Save xlplugins/6b69a7b5d1acfdcd4abec44ba68df45b to your computer and use it in GitHub Desktop.
HIde free shipping for Recurring cart At funnelkit checkout
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