[英]How to hide payment gateways for free products in WooCommerce?
I have a free product on woocommerce.我在 woocommerce 上有一个免费产品。 But the stripe payment gateway ask for credit card payment even if it is free with a total of 0€.
但是条纹支付网关要求信用卡支付,即使它是免费的,总共 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.我确信我不是世界上唯一一个在 woocommerce 商店添加一些免费产品的人。 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谢谢
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).代码位于活动子主题(或活动主题)的 function.php 文件中。 Tested and works.
测试和工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.