Skip to content

Instantly share code, notes, and snippets.

@robskidmore
Last active January 3, 2016 21:59
Show Gist options
  • Save robskidmore/8525386 to your computer and use it in GitHub Desktop.
Save robskidmore/8525386 to your computer and use it in GitHub Desktop.
Autocomplete Woocommerce order based on payment gateway
<?php
// Update order status based on the id of payment gateway
function credit_card_complete_order_status( $order_id ) {
$order = new WC_Order( $order_id );
if ( $order->payment_method == 'authorize_net' ) {
$order->update_status('completed', 'Automatically Completed');
}
}
add_action( 'woocommerce_payment_complete', 'credit_card_complete_order_status' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment