Skip to content

Instantly share code, notes, and snippets.

@rafsuntaskin
Created July 29, 2021 21:15
Show Gist options
  • Save rafsuntaskin/6afdcc0445b70da2146abbab7552dfbc to your computer and use it in GitHub Desktop.
Save rafsuntaskin/6afdcc0445b70da2146abbab7552dfbc to your computer and use it in GitHub Desktop.
CT change all Pending status payouts to completed by changing any order status to completed
<?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-paid' WHERE post_status = 'tribe-payout-pending'" );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment