-
-
Save lukecav/598ef9bc39aa1ea1eb44360267bb3bfb to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| /** | |
| * Autocomplete Paid Orders (WC 2.2+) | |
| */ | |
| add_filter( 'woocommerce_payment_complete_order_status', 'bryce_wc_autocomplete_paid_paypal_orders' ); | |
| function bryce_wc_autocomplete_paid_paypal_orders( $order_status, $order_id ) { | |
| $order = wc_get_order( $order_id ); | |
| if ( $order->payment_method == 'paypal' ) { | |
| if ( $order_status == 'processing' && ( $order->status == 'on-hold' || $order->status == 'pending' || $order->status == 'failed' ) ) { | |
| return 'completed'; | |
| } | |
| } | |
| return $order_status; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment