Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example of how to change the return to event list button displayed on the cart modal based on the terms set the event the ticket submission is for.
<?php // Do not add the opening PHP tag if you already have one.
function tw_ee_mer_change_event_list_url_from_term($default_event_list){
// Check if this is an ajax request.
if (wp_doing_ajax()){
// Check we have an event id.
if (!empty($_POST['tkt-slctr-event-id'])) {
$EVT_ID = absint($_POST['tkt-slctr-event-id']);
if (has_term( 'courses-seminars', 'espresso_event_categories', $EVT_ID ) ){
return 'https://domain.com/courses-seminars/';
} elseif (has_term( 'summerschool', 'espresso_event_categories', $EVT_ID ) ) {
return 'https://domain.com/summer-school/';
}
}
}
// Return the default event list url.
return $default_event_list;
}
add_filter( 'FHEE__EED_Multi_Event_Registration__set_definitions__events_list_url', 'tw_ee_mer_change_event_list_url_from_term' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.