Access our premium support and let us know your problems, we will help you solve them.

0
No products in the cart.

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • blankmr.-jo
    Participant

    Disable the mail under WooCommerce >> Settings >> Emails you want to only sent in case your order has a custom status.

    Now just sent it in case your order has the correct status:

    add_action( 'woocommerce_thankyou', 'woocommerce_thankyou_change_order_status', 10, 1 );
    function woocommerce_thankyou_change_order_status( $order_id ) {
        if ( ! $order_id ) {
            return;
        }
    
        $order   = wc_get_order( $order_id );
        $user_id = $order->get_user_id();
    
        if ( ( $order->get_status() == 'processing' || $order->get_status() == 'pending' || $order->get_status() == 'on-hold' ) && dokan_is_user_seller( $user_id ) && is_user_logged_in() ) {
            $order->update_status( 'mystatus' );
    
            $email_oc = new WC_Email_Customer_Completed_Order();
            $email_oc->trigger($order_id);
        }
    }
    

    You can just sent every WooCommerce mail from PHP you want.

Viewing 1 post (of 1 total)