I need help for my WooCommerce Shop. Our customers get free shipping after a amount of 39€. If our customers get a price under 39€ after using a coupon, shipping is no more free.
So for example:
Customers is on Cart, full cart amount is 42€ = Shipping Free.
Use -15% off Coupon = cart amount is 38,55 = Shipping costs <- but this still have to be free
In the plugin i use, i can set the setting "allow shipping free" but then the customer gets shipping free after the minimum amount for the coupon so this isnt usefull for us.
I use the Plugin = WooCommerce Extended Coupon Features FREE https://de.wordpress.org/plugins/woocommerce-auto-added-coupons/
Hope you guys understand what I mean
You can achieve this by using a simple code snippet.
you need to config one Free shipping without any Minimum order amount and a Flat rate to display normal shipping.
Now copy and paste below snippet into functions.php. It will hide free shipping if the subtotal less than 39, otherwise hide flat rate
add_filter( 'woocommerce_package_rates', 'modify_shipping_rate', 15, 2 );
function modify_shipping_rate( $available_shipping_methods, $package ){
global $woocmmerce;
$total_coast = WC()->cart->get_subtotal();
if( $total_coast < 39 ){
unset($available_shipping_methods['free_shipping:4']); // Config the Free Shipping method id properly
}else{
unset($available_shipping_methods['flat_rate:1']); //// Config the Flatrate shipping method id properly
}
return $available_shipping_methods;
}