Reputation: 709
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?
Upvotes: 3
Views: 805
Reputation: 3424
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
.
Upvotes: 6