Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created October 3, 2018 14:18
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save joshfeck/a7578b2a75c6b7bdcb67abdbff4b55d3 to your computer and use it in GitHub Desktop.
Send a custom order description to Stripe that includes the primary attendee name and the event name. Event Espresso 4.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter( 'FHEE__EE_PMT_Stripe_Onsite__generate_new_billing_form__description',
'stripe_att_name_event_name_order_description', 10, 2
);
function stripe_att_name_event_name_order_description( $desc, $transaction ) {
$desc = 'Tickets';
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