Skip to content

Instantly share code, notes, and snippets.

@growdev
Created January 9, 2018 14:46
Show Gist options
  • Save growdev/3cd6544b1ffca6cd730b914b8c880699 to your computer and use it in GitHub Desktop.
Save growdev/3cd6544b1ffca6cd730b914b8c880699 to your computer and use it in GitHub Desktop.
set orders to complete
<?php
add_filter( 'woocommerce_payment_complete_order_status', 'growdev_order_payment_complete_order_status', 10, 2 );
function growdev_order_payment_complete_order_status( $order_status, $order_id ) {
$order = wc_get_order( $order_id );
if ( 'processing' == $order_status &&
( 'pending' == $order->status ) ) {
$order_status = 'completed';
}
return $order_status;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment