Skip to content

Instantly share code, notes, and snippets.

@rafsuntaskin
Created October 30, 2019 15:17
Show Gist options
  • Save rafsuntaskin/5738d79fe102dff7703a8c5641be9a44 to your computer and use it in GitHub Desktop.
Save rafsuntaskin/5738d79fe102dff7703a8c5641be9a44 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'" );
}
}
@skyshab
Copy link

skyshab commented Jul 24, 2020

This should be deactivated immediately after triggering the status change on the order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment