将COD默认订单状态更改为“保留".而不是“处理中"在Woocommerce中 [英] Change COD default order status to "On Hold" instead of "Processing" in Woocommerce

查看:287
本文介绍了将COD默认订单状态更改为“保留".而不是“处理中"在Woocommerce中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要解决与插件"WooCommerce Pay for Payment"相关的问题,该问题需要支付一些额外的运输费用.问题是,此插件自动设置顺序为处理中"状态,从而导致感谢电子邮件付款(在本地付款的情况下),并且不发送有关新订单的电子邮件通知,因此客户感到困惑(我没有发送任何邮件)钱,并且我收到了一封感谢您付款"的电子邮件.)

I need help with a problem-related to plugin "WooCommerce Pay for Payment" which counting some extra fee in shipping. Problem is, that this plugin sets automatically "processing" status in order which causes thanking email for payment (in case of local payment) and don't send email notification about a new order, so customer is confused (I didn't send any money and I received email "thanks for your payment").

我尝试了以下解决方案:从处理到待处理的订单创建时,设置WooCommerce订单状态

I tried this solution: Set WooCommerce order status when order is created from processing to pending

但是它只会将订单状态更改回保留"状态,但无论如何都会发送电子邮件感谢您付款.

But it only changes order status back to "on-hold" but sends email thank for payment anyway.

我需要做的就是在每封有关新订单的新订单电子邮件中向客户发送邮件,仅此而已(我想手动将状态更改为处理中").

Only one thing that I need is to send to the customer in every new order email about a new order, nothing more (I would like to change status to "processing" manually).

谢谢您的帮助,我不知道如何解决,因为我找不到在插件中引起状态变化的PHP文件.

Thank you for help, I have no idea how to resolve because I couldn't find PHP file causing a change of status in the plugin.

对不起.这是woocommerce插件中的COD问题.正如我提到的,不付款. Woocommerce COD自动设置处理中"状态.

我在github上找到了解决方案:在这里

I found solution for this on github:here

它是第一个代码.

根据该问题的答案,此代码有效:

Based on the answer to this question, this code worked fine for me:

function sv_wc_cod_order_status( $status ) {
    return 'on-hold';
}
add_filter( 'woocommerce_cod_process_payment_order_status', 'sv_wc_cod_order_status', 15 ); 

推荐答案

已更新:的付款网关(COD)的默认订单状态设置为保留" :

Updated: The code that you found in Github is outdated, clumsy and complicated, since there is a dedicated filter hook now. You should better try this lightweight and effective code, that will set the default order status for "Cash on delivery" payment gateway (COD) to "On Hold":

add_filter( 'woocommerce_cod_process_payment_order_status', 'change_cod_payment_order_status', 10, 2 );
function change_cod_payment_order_status( $order_status, $order ) {
    return 'on-hold';
}

代码进入您的活动子主题(活动主题)的functions.php文件中.经过测试,可以正常工作.

Code goes in functions.php file of your active child theme (active theme). Tested and works.





因此,付款网关设置的默认订单状态现在为暂停",而不是正在处理"

So the default order status set by the payment gateway is now "On Hold" instead of "Processing"

这篇关于将COD默认订单状态更改为“保留".而不是“处理中"在Woocommerce中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆