As an online store owner focused on booking appointments, rentals, and other booking services, using our WooCommerce Booking and Appointment plugin offers a complete solution. Undoubtedly, from managing bookings to providing a seamless customer experience the booking process is made entirely easy.
Now, we are going to provide additional customization so that you can customize WooCommerce emails. Sending out too much information can clutter the emails and make them less user-friendly. In this post, we will explore how to remove booking details from WooCommerce emails.
Solution: Remove Booking Details from WooCommerce Emails using Booking and Appointment Plugin
This code will customize the content of WooCommerce order emails sent to customers by removing certain booking-related metadata fields ($start_date, $end_date, $time) from the displayed information.
/** * Removing Booking details from WooCommerce Emails. */ function unset_booking_order_item_meta_data( $formatted_meta, $item ) { $start_date = bkap_option( 'email_start_date' ); $end_date = bkap_option( 'email_end_date' ); $time = bkap_option( 'email_time' ); if ( did_action( 'woocommerce_email_order_meta' ) || did_action( 'woocommerce_email_after_order_table' ) ) { foreach ( $formatted_meta as $key => $meta ) { if ( in_array( $meta->key, array( $start_date, $end_date, $time ), true ) ) { unset( $formatted_meta[ $key ] ); } } } } add_filter( 'woocommerce_order_item_get_formatted_meta_data', 'unset_booking_order_item_meta_data', 10, 2 );
Output
The below output shows how booking details are removed from WooCommerce order emails so that customers receive a simplified email.
Let’s also look into the output before implementing the code, which will display the booking details in WooCommerce order emails.
If you’re interested in making more tweaks and improvements to your WooCommerce booking system, we’ve covered many solutions! From customizing WooCommerce emails and even providing discounts for bookings made early in advance, there are various ways to help you manage your bookings more easily than ever before. Feel free to ask for any customization in the comment section.