If you want to do something after WooCommerce order completed then use this code.

woocommerce_order_status_completed action hook is a built-in hook of WooCommerce. It allows you to execute a function as when the order is completed. Add your stuff in inside of my_function().

add_action( 'woocommerce_order_status_completed', 'my_function' );
/*
 * Do something after WooCommerce sets an order on completed
 */
function my_function($order_id) {
	
	// order object (optional but handy)
	$order = new WC_Order( $order_id );
	// do some stuff here
	
}

Have any doubt, then comment here!

Leave a Reply

Your email address will not be published. Required fields are marked *