Skip to content

Instantly share code, notes, and snippets.

@kartikparmar
Last active March 19, 2026 08:31
Show Gist options
  • Select an option

  • Save kartikparmar/4e251146516ef38f3e2f1df37b30a36a to your computer and use it in GitHub Desktop.

Select an option

Save kartikparmar/4e251146516ef38f3e2f1df37b30a36a to your computer and use it in GitHub Desktop.
To add the item meta information in the google calendar event description.
/**
* Adding the meta data to the Google Event Description
*
* @param string $description Event Description.
* @param obj $app Objection of all information for the calculation.
*/
function bkap_google_event_description_callback( $description, $app ) {
$item_id = $app->item_id;
$item = new WC_Order_Item_Product( $item_id );
$item_data = $item->get_data();
$formatted_meta_data = $item->get_formatted_meta_data( '_', true );
$name = get_option( 'book_item-meta-date' );
$name = ( '' == $name ) ? __( 'Start Date', 'woocommerce-booking' ) : $name;
$name_checkout = get_option( 'checkout_item-meta-date' );
$name_checkout = ( '' == $name_checkout ) ? __( 'End Date', 'woocommerce-booking' ) : $name_checkout;
$name_time_slot = get_option( 'book_item-meta-time' );
$name_time_slot = ( '' == $name_time_slot ) ? __( 'Booking Time', 'woocommerce-booking' ) : $name_time_slot;
$labels = array( "Geburtsdatum (Geburtsjahr: auf aktuelles Jahr klicken und ändern!)" ); // BirthDate Label .
$extra_data = '';
foreach ( $formatted_meta_data as $key => $value ) {
if ( in_array( $value->key, $labels ) ) { // Check only for birthdate data.
$extra_data .= '<br>' . $value->display_key . ' : ' . $value->display_value;
}
}
$description = str_replace(
array( 'ADDITIONAL_DATA' ),
array( $extra_data ),
$description
);
return $description;
}
add_filter( 'bkap_google_event_description', 'bkap_google_event_description_callback', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment