Do some action after WooCommerce order completed

Published on Jul 11, 2015 & tagged in WordPress, WooCommerce

If you want to do something after WooCommerce order completed, we can hook our custom action into woocommerce_order_status_completed action hook.

add_action( 'woocommerce_order_status_completed', 'my_function' );
/*
 * Do something after WooCommerce set an order status as completed
 */
function my_function($order_id) {
	
	// order object (optional but handy)
	$order = new WC_Order( $order_id );

	// do some stuff here
	
}

Do you need any help on WordPress & WooCommerce?

I'm happy to help you. Just fill the form on contact page & I will get back to you within few hours.

Recent Posts

  1. Get current store details - Magento 1.9
  2. Simple ways to improve page conversion on product page
  3. Encrypt Email Addresses - PHP
  4. The add_image_size() function - WordPress best practices
  5. Remove page title using filter - WordPress