Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress - How to make shipping price zero in woocommerce?

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?

like image 278
raghuveer999 Avatar asked Dec 08 '25 03:12

raghuveer999


1 Answers

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;

  • Minimum order amount
  • Coupon (Users will need to enter a valid free shipping coupon code to use this method. If a coupon is used, the minimum order amount will be ignored)
  • You can also choose specific countries to which free shipping is allowed.

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.

like image 185
Nadeem Khan Avatar answered Dec 10 '25 15:12

Nadeem Khan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!