I want users to have a free checkout for my subscription service if they have 100% discount coupon code for the product. So if cart total gets equal to zero, then there should be no payment gateway and users should be able to signup directly.
I think WooCommerce don't allow working without payment gateway or can be difficult to modify, so I want to change the current payment gateway to "Cash on Delivery" if cart total equals to 0 . I shall change Cash on delivery text to something else later.
Here is link to my dummy development. Use Couponcode: abcd1234 Here is the function that I'm using to hide payment gateways in my functions.php file :
add_filter( 'woocommerce_available_payment_gateways', 'paypal_100' );
function paypal_100($available_gateways) {
if ( WC()->cart->total == '0' ) {
unset( $available_gateways);
}
return $available_gateways;
}
Thanks in advance, Yash