Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.