-
-
Save Pebblo/2b0433f851e18d6ddd6fb85eca78b440 to your computer and use it in GitHub Desktop.
Example of how to alter the line item descriptions to include the ticket name and datetime names if the line item is not a promotion.
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 | |
function ee_revise_registration_checkout_line_item_desc( $original_description, $line_item, $options ) { | |
if( $line_item->ticket() instanceof EE_Ticket && $line_item->OBJ_type() !== 'Promotion' ) { | |
$datetime_names = array(); | |
foreach( $line_item->ticket()->datetimes() as $datetime ) { | |
$datetime_names[] = $datetime->get_dtt_display_name(true); | |
} | |
return sprintf( __( ' for "%1$s", <br />Date/time: %2$s', 'event_espresso' ), | |
$line_item->ticket_event_name(), | |
implode(", ", $datetime_names ) | |
); | |
} | |
return $original_description; | |
} | |
add_filter ('FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc', 'ee_revise_registration_checkout_line_item_desc', 10, 3); |
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 | |
function ee_revise_registration_checkout_line_item_desc( $original_description, $line_item, $options ) { | |
if( $line_item->ticket() instanceof EE_Ticket && $line_item->OBJ_type() !== 'Promotion' ) { | |
$datetime_dates = array(); | |
foreach( $line_item->ticket()->datetimes() as $datetime ) { | |
$datetime_dates[] = $datetime->date_and_time_range(); | |
} | |
return sprintf( __( ' for "%1$s", <br />Date/time: %2$s', 'event_espresso' ), | |
$line_item->ticket_event_name(), | |
implode(", ", $datetime_dates ) | |
); | |
} | |
return $original_description; | |
} | |
add_filter('FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc', 'ee_revise_registration_checkout_line_item_desc', 20, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment