Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Created October 12, 2020 15:48
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/727a4005e3247754e5787cdffa4a269e to your computer and use it in GitHub Desktop.
Save Pebblo/727a4005e3247754e5787cdffa4a269e to your computer and use it in GitHub Desktop.
Example of to change the defautl gateway order description to use an itemized list of '{ticket name} x {qty}'
<?php // Please do not include the opening PHP tag if you already have one
add_filter( 'FHEE__EE_Gateway___order_description',
'tw_ee_itemized_tickets_description', 10, 3
);
function tw_ee_itemized_tickets_description( $desc, $gateway, $payment ) {
$desc_array = array();
$txn = $payment->transaction();
$ticket_line_items = EEH_Line_Item::get_ticket_line_items($txn->total_line_item());
foreach($ticket_line_items as $ticket_line_item) {
if( $ticket_line_item instanceof EE_Line_Item) {
$desc_array[] = $ticket_line_item->name() . ' x ' . $ticket_line_item->quantity();
}
}
if( !empty($desc_array) ) {
return implode(", ", $desc_array);
}
return $desc;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment