Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Created February 14, 2018 11:31
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/9b6864bbd3c8253607bbd35592656962 to your computer and use it in GitHub Desktop.
Save Pebblo/9b6864bbd3c8253607bbd35592656962 to your computer and use it in GitHub Desktop.
Example of how to change the description sent to the payment providers to '{Event name} tickets for {attendee_names}'
<?php //Please do not include the opening PHP tag if you already have one
add_filter( 'FHEE__EE_Gateway___order_description',
'my_custom_order_description_with_date', 10, 3
);
function my_custom_order_description_with_date( $desc, $gateway, $payment ) {
$desc = '';
$transaction = $payment->transaction();
$primary_registrant = $transaction->primary_registration();
if( $primary_registrant instanceof EE_Registration ) {
$event = $primary_registrant->event_obj();
if ( $event instanceof EEI_Event ) {
$desc = $event->name() . ' ';
}
}
$desc .= 'tickets for ';
$primary_registration = $transaction->primary_registration();
if( $transaction instanceof EEI_Transaction ) {
$registrations = $transaction->registrations();
foreach( $registrations as $registration ) {
if( $registration instanceof EE_Registration ) {
$attendee = $registration->attendee();
$desc .= $attendee->full_name() . ', ';
}
}
//Remove triling ', '
$desc = substr($desc, 0, -2);
}
return $desc;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment