PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, February 8, 2022

[FIXED] WooCommerce send order complete email automatically

 February 08, 2022     hook-woocommerce, woocommerce, wordpress     No comments   

Issue

I'm faced with a little problem. I need to send the Customer Invoice / Order Details email automatically when an order is completed.

I haven't found any action or filter to apply in this case an the internet is not useful. Has anyone an idea how to send this email when the order status switches?

Best regards!


Solution

You can use woocommerce_order_status_completed hook and WC_Email_Customer_Invoice

add_action( 'woocommerce_order_status_completed', 'mysite_woocommerce_order_status_completed', 10, 1);

function mysite_woocommerce_order_status_completed( $order_id ) {
   // Send invoice email to customer
   //use order ID as trigger value
   WC()->mailer()->emails['WC_Email_Customer_Invoice']->trigger($order_id);
}


Answered By - Ozgur Sar
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing