Skip to content

Instantly share code, notes, and snippets.

@the-sufi
Last active April 6, 2020 01:25
Show Gist options
  • Save the-sufi/6f0f68fcf8efd70b33dbb23481aeda31 to your computer and use it in GitHub Desktop.
Save the-sufi/6f0f68fcf8efd70b33dbb23481aeda31 to your computer and use it in GitHub Desktop.
WooCommerce - Automactically Mark Orders as Complete
<?php
/**
* Auto Complete all WooCommerce orders.
*/
function dctit_custom_woocommerce_auto_complete_order( $order_id ) {
if ( ! $order_id ) {
return;
}
$order = wc_get_order( $order_id );
$order->update_status( 'completed' );
}
add_action( 'woocommerce_thankyou', 'dctit_custom_woocommerce_auto_complete_order' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment