Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Last active February 10, 2020 16:49
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 joshfeck/28fd4886176dd189f09d51f6a5ffd2b2 to your computer and use it in GitHub Desktop.
Save joshfeck/28fd4886176dd189f09d51f6a5ffd2b2 to your computer and use it in GitHub Desktop.
PayPal Express order description: Attendee name + Event name. This also works for any other EE gateway that uses the formatOrderDescription method, including SagePay.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter( 'FHEE__EE_Gateway___order_description',
'att_name_event_name_order_description', 10, 3
);
function att_name_event_name_order_description( $desc, $gateway, $payment ) {
$desc = 'Tickets';
$transaction = $payment->transaction();
if( $transaction instanceof EEI_Transaction ) {
$primary_registrant = $transaction->primary_registration();
if( $primary_registrant instanceof EE_Registration ) {
$attendee = $primary_registrant->attendee();
if ($attendee instanceof EE_Attendee) {
$desc = $attendee->get('ATT_full_name');
}
$event = $primary_registrant->event_obj();
if ( $event instanceof EEI_Event ) {
$desc .= ' ' . $event->name();
}
}
}
return $desc;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment