Created
December 10, 2020 14:20
-
-
Save stuartduff/13bc9bee24142b36ca4e0050cddaafb5 to your computer and use it in GitHub Desktop.
Change Failed orders in WooCommerce to the order status of Pending
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
/** | |
* Set failed orders to pending payment. | |
*/ | |
function wc_failed_to_pending( $order_id ){ | |
$order = new WC_Order( $order_id ); | |
$order->update_status( 'pending' ); | |
} | |
add_action( 'woocommerce_order_status_failed', 'wc_failed_to_pending'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment