Ready to get started?Download WordPress


Easy Digital Downloads
Features request (7 posts)

  1. Kjow
    Posted 1 year ago #


    I would have, if possible, a couple of interesting features:

    1) Is it possible to run a script (php) after the purchase and insert the output into the email? It also would be nice to pass to the script some parameters (like user name, etc).

    2) Download a free file (e.g. a demo) without to pass for checkout. Otherwise this could be seen by users as a way to pay for free demo.

    Thank you!


  2. 1) Yes, absolutely. Are you familiar with WordPress action hooks?

    2). This won't be possible as the email / user info is required for processing file downloads.

  3. Kjow
    Posted 1 year ago #

    1) Unfortunately, not. But I could try! I will look for tutorial about these.
    What do I need to do with action hooks?

    2) Ok, so I need a download manager for free files and "Easy Digital Downloads" for purchases. :)

    Thank you!

  4. 1) I can show you a simple example. Do you want to run a function when a purchase is first made, or when its payment is confirmed as complete?

    2) If you want to avoid the checkout process, yes.

  5. Kjow
    Posted 1 year ago #

    1) Yes, thank you!
    At the moment I need when the payment is confirmed as complete.


  6. Here you go:

    function pw_runs_when_payment_complete($payment_id, $new_status, $old_status) {
    	if( $old_status == 'publish' || $old_status == 'complete')
    		return; // make sure that payments are only completed once
    	if( ! edd_is_test_mode() ) {
    		$payment_data 	= get_post_meta($payment_id, '_edd_payment_meta', true);
    		$downloads 		= maybe_unserialize($payment_data['downloads']);
    		$user_info 		= maybe_unserialize($payment_data['user_info']);
    		$cart_details 	= maybe_unserialize($payment_data['cart_details']);				
    		// run something for each product purchased
    		foreach($downloads as $download) {
    			// $download['id'] is the ID number of the product purchased
    			// $payment_data, $user_info, and $cart details contain a lot of other info you might need.
    	// empty the shopping cart
    add_action('edd_update_payment_status', 'pw_runs_when_payment_complete', 10, 3);
  7. Kjow
    Posted 1 year ago #

    Thanks, I will try soon!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic