I have a condition where I want to make shipping price zero. Is there any predefined function for that? like we have a predefined function for making the cart empty,
$woocommerce->cart->empty_cart();
Similarly is there any function to make shipping price zero?
As per the official documentation:
If free shipping is enabled customers will have access to free shipping on their orders. You can however specify a few conditions they must meet to be granted free shipping such as;
Further, the free shipping method has an is_available function which can be hooked into:
return apply_filters( 'woocommerce_shipping_' . $this->id . '_is_available', $is_available );
This means you can use add_filter() on woocommerce_shipping_free_shipping_is_available and return true or false.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With