WooCommerce change order status BACS processing

后端 未结 3 758
无人及你
无人及你 2021-01-01 03:29

In WooCommerce any order placed with the BACS (direct bank transfer) is set to \"on-hold\".

How would one go about changing this automa

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-01 04:08

    There is a new filter which will allow you to set the status when BACS 'payment' is processed.

    /**
     * Change the default status when BACS 'payment' is processed.
     * 
     * @see WC_Gateway_BACS::process_payment()
     * woocommerce/includes/gateways/bacs/class-wc-gateway-bacs.php:362
     * @since Mar 8, 2018
     * @link https://github.com/woocommerce/woocommerce/blob/750fda3b1b55c55645f626d3873d956282e3ac1b/includes/gateways/bacs/class-wc-gateway-bacs.php#L364
     * 
     * @filter woocommerce_bacs_process_payment_order_status
     * @priority 10
     * @args 2
     * 
     * @param string $status Status to filter. Default 'on-hold'.
     * @param WC_Order $order
     * @return string New status 'processing'.
     */
    add_filter( 'woocommerce_bacs_process_payment_order_status', function( $status = 'on_hold', $order = null ) {
        return 'processing';
    }, 10, 2 );
    

提交回复
热议问题