Skip to content

Instantly share code, notes, and snippets.

@ddemuth
Created June 26, 2016 17:56
Show Gist options
  • Save ddemuth/aba6e4ecbfcdf05e4792afad05a83b6c to your computer and use it in GitHub Desktop.
Save ddemuth/aba6e4ecbfcdf05e4792afad05a83b6c to your computer and use it in GitHub Desktop.
AUTO COMPLETE PAID ORDERS THAT ARE PAID BY CARD OR eCHECK
/**
* AUTO COMPLETE PAID ORDERS THAT ARE PAID BY CARD OR eCHECK
*/
function fka_skip_processing_on_electronic_order( $status, $order_id ) {
// No updated status for orders delivered with Bank wire, Cash on delivery and Cheque payment methods.
if ( ( get_post_meta($order->id, '_payment_method', true) == 'bacs' ) || ( get_post_meta($order->id, '_payment_method', true) == 'cod' ) || ( get_post_meta($order->id, '_payment_method', true) == 'cheque' ) ) {
return;
}
else {
// Skip processing order status and mark as completed
$status = 'wc-completed';
}
return $status;
}
/**
* FILTER ADDED IN A PLUGIN CLASS BUT COULD BE OUTSIDE OF CLASS
* EXAMPLE:
* add_filter( 'woocommerce_payment_complete_order_status', 'fka_skip_processing_on_electronic_order', 10, 2);
*/
add_filter( 'woocommerce_payment_complete_order_status', array( $this, 'fka_skip_processing_on_electronic_order' ), 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment