Skip to content

Instantly share code, notes, and snippets.

@skyshab
Forked from rafsuntaskin/functions.php
Created January 27, 2021 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save skyshab/1a108757e54ed7746962c51deb7eb3e5 to your computer and use it in GitHub Desktop.
Save skyshab/1a108757e54ed7746962c51deb7eb3e5 to your computer and use it in GitHub Desktop.
Reset failed payout status for CT on Order status toggle
<?php
add_action( 'woocommerce_order_status_changed', 'rt_ct_reset_failed_payouts', 9, 4 );
function rt_ct_reset_failed_payouts( $order_id, $status_from, $status_to, $order ) {
global $wpdb;
if ( 'completed' == $status_to ) {
$query = $wpdb->query( "UPDATE $wpdb->posts SET post_status = 'tribe-payout-pending' WHERE post_status = 'tribe-payout-failed'" );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment