Skip to content

Instantly share code, notes, and snippets.

@robin-scott
Created February 6, 2018 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robin-scott/74a8bac69c1adb78de4660d2a3351a5a to your computer and use it in GitHub Desktop.
Save robin-scott/74a8bac69c1adb78de4660d2a3351a5a to your computer and use it in GitHub Desktop.
Automatically complete woocommerce orders when paid
// Automatically complete woocommerce orders on successful payment (skip "processing") - Robin Scott for SiliconDales.com
add_action( 'woocommerce_thankyou', 'sd_woocommerce_auto_complete_order' );
function sd_woocommerce_auto_complete_order( $order_id ) {
if ( ! $order_id ) {
return;
}
$order = wc_get_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