Skip to content

Instantly share code, notes, and snippets.

@dryan1144
Created November 26, 2020 07:37
Show Gist options
  • Save dryan1144/539dc155768c3ac36e895466cbd76d73 to your computer and use it in GitHub Desktop.
Save dryan1144/539dc155768c3ac36e895466cbd76d73 to your computer and use it in GitHub Desktop.
EDD callback for payment status updates
<?php
/***
Actions after purchase status is changed - useful for check payments
***/
function drw_edd_after_check_purchase( $payment_id, $new_status, $old_status ) {
//bail if the order isn't approved
if ( !in_array($new_status, array('publish', 'complete')) ) {
return;
}
$payment = new EDD_Payment( $payment_id );
$user_id = $payment->user_id;
//Do something with payment data
drw_update_data($user_id, $payment);
}
add_action( 'edd_update_payment_status', 'drw_edd_after_check_purchase', 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment