Skip to content

Instantly share code, notes, and snippets.

@stuartduff
Created December 10, 2020 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuartduff/13bc9bee24142b36ca4e0050cddaafb5 to your computer and use it in GitHub Desktop.
Save stuartduff/13bc9bee24142b36ca4e0050cddaafb5 to your computer and use it in GitHub Desktop.
Change Failed orders in WooCommerce to the order status of Pending
/**
* 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