Change COD default order status to “On Hold” instead of “Processing” in Woocommerce

前端 未结 3 964
情书的邮戳
情书的邮戳 2020-12-04 01:17

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 \"pro

3条回答
  •  暖寄归人
    2020-12-04 01:42

    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';
    }
    

    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"

提交回复
热议问题