📜  订单状态自动从“暂停”更改为“处理中” - 无论代码示例

📅  最后修改于: 2022-03-11 14:58:37.186000             🧑  作者: Mango

代码示例2
add_action('woocommerce_order_status_changed', 'ts_auto_complete_by_payment_method');

function ts_auto_complete_by_payment_method($order_id)
{

if ( ! $order_id ) {
return;
}

global $product;
$order = wc_get_order( $order_id );

if ($order->data['status'] == 'on-hold') {
$payment_method=$order->get_payment_method();
if ($payment_method!="COD")  // change payment method 
{
$order->update_status( 'processing' );
}}}