Skip to content

Instantly share code, notes, and snippets.

@prestonw
Last active July 7, 2020 14:52
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 prestonw/2edaaecd234239f12b25b4e1e43a9a87 to your computer and use it in GitHub Desktop.
Save prestonw/2edaaecd234239f12b25b4e1e43a9a87 to your computer and use it in GitHub Desktop.
Simply create a mu-plugin folder in your wp-content folder and add this woo-autocomplete.php file.
<?php
defined( 'ABSPATH' ) or die( 'Go Away!' );
/**
* Plugin Name: WooCommerce AutoComplete Plugin
* Description: AutoComplete all sales on WooCommerce.
* Author: Will Preston
* License: GNU General Public License v3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
/* Auto Complete All WooCommerce Orders */
add_action( 'woocommerce_thankyou', 'woocommerce_auto_complete_order' );
function 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