Created
November 16, 2021 11:50
-
-
Save pascalbajorat/740ef61a96c7b8d7f944de3ce94ef3c1 to your computer and use it in GitHub Desktop.
Autocomplete WooCommerce Orders
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 | |
/* | |
* Plugin Name: Autocomplete WooCommerce Orders | |
* Plugin URI: https://www.bajorat-media.com | |
* Description: Autocomplete WooCommerce Orders | |
* Version: 1.0.1 | |
* Author: Bajorat Media | |
* Author URI: https://www.bajorat-media.com | |
* License: GPLv2 or later | |
* License URI: https://www.bajorat-media.com | |
*/ | |
/** | |
* Auto Complete all WooCommerce orders. | |
*/ | |
add_action( 'woocommerce_thankyou', 'bm_woocommerce_auto_complete_order' ); | |
function bm_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