Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Last active June 29, 2017 12:30
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/2b0433f851e18d6ddd6fb85eca78b440 to your computer and use it in GitHub Desktop.
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.
<?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);
<?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