-
-
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}'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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