Support

Home Forums Event Espresso Premium Getting payment and transaction objects from hook after payment is applied Reply To: Getting payment and transaction objects from hook after payment is applied

Reply To: Getting payment and transaction objects from hook after payment is applied

Author Replies
Tony # Posted on May 2, 2018 at 10:21 am

wp_mail('john-henry@dieselbrook.co.za', 'test object', $payment_object); //this doesn't work, meaning that it can't find the data

You’re passing the payment_object to wp_mail, not the event_id.

So:

wp_mail('john-henry@dieselbrook.co.za', 'test object', $event_id);

Would be an email containing the event id.

Also:

$payment_object = $payment instanceof EE_Payment ? $payment : null;

If for some reason $payment wasn’t an instance of EE_Payment, your going to get fatal errors as your function then runs methods on null below…

$event = $payment_object->get_first_event();

If $payment_object is null, fatal error.

So rather than setting the var as null, return instead:

if( ! $payment_object instanceof EE_Payment ) {
    //get out, you don't have an EE_Payment object to work with.
    return;
}
Do NOT follow this link or you will be banned from the site!