No products in the cart.
Forum Replies Created
Viewing 1 post (of 1 total)
- AuthorPosts
-
July 1, 2021 at 2:02 am in reply to: Disable WooCommerce order email notification for orders with custom status #11124
mr.-jo
ParticipantDisable 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.
- AuthorPosts
Viewing 1 post (of 1 total)