Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/14acf044ca0a4aef2cc417be742f7400 to your computer and use it in GitHub Desktop.
Save Pebblo/14acf044ca0a4aef2cc417be742f7400 to your computer and use it in GitHub Desktop.
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