我一直在 Woocommerce 中使用“货到付款”付款方式,并在 Woocommerce 中添加了自定义订单状态“COD”。如果用户选择了“COD”付款选项,我一直在使用以下代码将订单移至“COD”。
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 'cod';
}
Run Code Online (Sandbox Code Playgroud) wordpress ×1