简体   繁体   English

从WooCommerce中删除支付网关

[英]Removing payment gateways from WooCommerce

I have a WooCommerce shop (running local) but I want to remove the payment gateways. 我有一个WooCommerce商店(在本地运行),但我想删除支付网关。 The customer should be able to place an order without paying any cent, I will send them an invoice manually. 客户应该能够在不支付任何费用的情况下下订单,我会手动向他们发送发票。

I can not really find where to disable this, it seems not to be standard in WooCommerce. 我无法真正找到禁用它的地方,它似乎不是WooCommerce的标准。

Have tried disabling all the payment gateways in the backend, but you have to leave one payment gateway enabled. 尝试禁用后端中的所有支付网关,但您必须启用一个支付网关。

Thanks in advance! 提前致谢!

只需在您的主题中的functions.php中添加以下行: add_filter('woocommerce_cart_needs_payment', '__return_false');

Leave 'Cash on Delivery' enabled, and it won't take a payment at the checkout. 保持“货到付款”功能,并且不会在结账时付款。 You can easily change the 'Cash on Delivery' titles and labels to something like 'No Payment Required' or similar. 您可以轻松地将“货到付款”标题和标签更改为“无需付款”或类似内容。

Something that the other answers to this question haven't addressed is the fact that you need a way for the customer to eventually pay the invoice. 对方回答这个问题没有解决的问题是,您需要一种方法让客户最终支付发票。 Using Cash on Delivery (renamed to suit your needs) perfectly accomplishes not having the user actually pay at checkout, but the problem is that if Cash on Delivery was your only payment method, it will still be the only payment method when you send them the invoice. 使用货到付款(重新命名以满足您的需求)完全实现了用户实际上没有在结账时付款,但问题是,如果货到付款是您唯一的付款方式,它仍然是您发送时的唯一付款方式发票。

I think in most cases you're going to want only cash on delivery during the cart checkout, and a different payment method (like Stripe) for the invoice payment method. 我认为在大多数情况下,您只需要在购物车结帐时使用货到付款,并使用不同的付款方式(如Stripe)进行发票付款方式。

Here's the full workflow to create a deferred payment setup. 这是创建延期付款设置的完整工作流程。

  1. Like @crdunst mentions, you should use Cash on Delivery and rename it to "Wait for Invoice" or something. 像@crdunst提到的那样,您应该使用货到付款并将其重命名为“等待发票”或其他内容。
  2. Enable all of the payment gateways that you ever want to use (in this example, we'll just use Cash on Delivery and Stripe. Cash on Delivery will be our "checkout" payment gateway, and Stripe will be our invoice payment gateway. 启用您想要使用的所有支付网关(在此示例中,我们将只使用货到付款和条带。货到付款将是我们的“结账”支付网关,Stripe将成为我们的发票支付网关。
  3. Use the following filter to turn on and off gateways based on whether or not you're on the order-pay endpoint (the page used for invoice payments). 使用以下过滤器根据您是否在order-pay端点(用于发票付款的页面)打开和关闭网关。

     /** * Only show Cash on Delivery for checkout, and only Stripe for order-pay * * @param array $available_gateways an array of the enabled gateways * @return array the processed array of enabled gateways */ function so1809762_set_gateways_by_context($available_gateways) { global $woocommerce; $endpoint = $woocommerce->query->get_current_endpoint(); if ($endpoint == 'order-pay') { unset($available_gateways['cod']); } else { unset($available_gateways['stripe']); } return $available_gateways; } add_filter( 'woocommerce_available_payment_gateways', 'so1809762_set_gateways_by_context'); 

Of course, if you're using a gateway other than stripe for the order-pay page, you'll want to make sure that you update unset($available_gateways['stripe']); 当然,如果您在order-pay页面上使用条带以外的网关,则需要确保更新未unset($available_gateways['stripe']); to the proper array key. 到正确的数组键。

After that, you should be good to go! 在那之后,你应该好好去! Your site will now display different gateways based on whether or not you're on the invoice pay page! 您的网站现在将根据您是否在发票付款页面上显示不同的网关!

Other option would be using BACS payment method, where you could explain the client that he will be invoiced later. 其他选择是使用BACS支付方式,您可以向客户解释他将在以后开具发票。

You can even add some info at the email that is sent when BACS is used. 您甚至可以在使用BACS时发送的电子邮件中添加一些信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 jQuery在付款网关woocommerce上不起作用 - Jquery doesnt work on payment gateways woocommerce WooCommerce仅显示登录客户的付款网关 - WooCommerce Show Payment Gateways for Logged In Customers Only 如何在 WooCommerce 中隐藏免费产品的支付网关? - How to hide payment gateways for free products in WooCommerce? WooCommerce结帐上的WordPress多个支付网关选择 - WordPress multiple payment gateways selection on WooCommerce checkout WooCommerce付款网关仅适用于已登录的客户 - WooCommerce Payment Gateways for Logged In Customers Only woocommerce信用卡支付网关未显示在“支付网关”页面中 - woocommerce credit card payment gateway not showing up in Payment gateways page 根据 WooCommerce 结账中的分类术语限制支付网关 - Restrict payment gateways based on taxonomy terms in WooCommerce checkout 如果在 Woocommerce 中应用了任何优惠券代码,则删除一些支付网关 - Remove some payment gateways if any coupon code is applied in Woocommerce 删除已定义产品类别组的 WooCommerce 支付网关 - Remove WooCommerce Payment Gateways for defined groups of product categories 添加一个复选框作为 WooCommerce 管理产品选项,禁用支付网关 - Add a checkbox as WooCommerce admin product option that disables payment gateways
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM