Last active
July 7, 2020 14:52
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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