Skip to content

Instantly share code, notes, and snippets.

@lmartins
Created November 25, 2014 22:42
Show Gist options
  • Save lmartins/0cb2cadbc980f47593f5 to your computer and use it in GitHub Desktop.
Save lmartins/0cb2cadbc980f47593f5 to your computer and use it in GitHub Desktop.
If you sell digital products then you’re not shipping anything. You can autocomplete your orders using the following code:
/**
* Auto Complete all WooCommerce orders.
* http://docs.woothemes.com/document/automaticaaly-complete-orders/
*/
add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' );
function custom_woocommerce_auto_complete_order( $order_id ) {
global $woocommerce;
if ( ! $order_id ) {
return;
}
$order = new WC_Order( $order_id );
$order->update_status( 'completed' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment