0

I just started with Easy Digital Downloads and i love it so far. I want to add data to the database when a payment was successful. For testing purpose i changed this to a echo. Unfortunately the echo isn't fired. Can someone help me out?

I placed this function in the /includes/download-functions.php

//Fire codes when payment received
function wd_edd_run_when_purchase_complete( $payment_id, $new_status, $old_status ) {

    // Make sure that payments are only completed once
    if( $old_status == 'publish' || $old_status == 'complete' ) {
        return;
    }

    // Make sure the payment completion is only processed when new status is complete
    if( $new_status != 'publish' && $new_status != 'complete' ){
        return;
    }

    $payment_data = edd_get_payment_meta( $payment_id );

    $currentUser = $user_info['id'];

   if ($download_id == "427") { // Item ID of downloaded file
    echo "Item EDD item ID: 427 added to the database. Purchase by: ".$currentUser;
    }

}
add_action( 'edd_update_payment_status', 'wd_edd_run_when_purchase_complete', 100, 3 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.