Reputation: 1203
I have a free product on woocommerce. But the stripe payment gateway ask for credit card payment even if it is free with a total of 0€. User can’t checkout without filling the stripe cc form.
Credit card info are not necessary when the product is for free.
I am sure I am not the only one on earth who add some free product in a woocommerce shop. How can I hide this "credticard form" in the check out page in order to let my members access to my free product? Do you know any plugin or hack?
Thanks
Upvotes: 2
Views: 3788
Reputation: 254388
Updated: You can use the following to disable checkout payment when there is only free products in cart:
add_filter( 'woocommerce_cart_needs_payment', 'filter_cart_needs_payment_callback', 100, 2 );
function filter_cart_needs_payment_callback( $needs_payment, $cart ) {
return $cart->subtotal > 0 ? $needs_payment : false;
}
Code goes in function.php file of your active child theme (or active theme). Tested and works.
Upvotes: 6