Support

Home Forums Event Espresso Premium EVT_ID value of the current event during checkout Reply To: EVT_ID value of the current event during checkout

Reply To: EVT_ID value of the current event during checkout

Author Replies
Josh # Posted on April 6, 2018 at 12:08 pm

Hi there,

If you check the source where the filter hook is:

$this->reg_code = apply_filters(
 'FHEE__Create__regCode__new_reg_code',
 implode( '-', $this->reg_code ),
 $transaction,
 $ticket
);

You’ll note there are 3 parameters, so if you change your callback function to start like this:

function ssoc_reg_code($new_reg_code, $transaction, $ticket) {

and update the add_filter call to have the correct number of parameters:

add_filter(‘FHEE__Create__regCode__new_reg_code’,’ssoc_reg_code’, 10, 3);

you’ll have access to the $ticket object.

Then you can get the event ID from the $ticket object.

if ( $ticket instanceof EE_Ticket ) {
    $dtt = $ticket->last_datetime();
    if ( $dtt instanceof EE_Datetime ) {
        $event = $dtt->event();
        if ( $event instanceof EE_Event ) {
            $evt_id = $event->ID();
        }
    }
}
Do NOT follow this link or you will be banned from the site!