Bookings: add return date to order email
-
By default, Woocommerce Bookings only shows the starting date in the booking overview. I added the return date using this code:
add_filter( 'woocommerce_get_item_data', 'so_34900999_display_cart_data', 10, 2 ); function so_34900999_display_cart_data( $item_data, $cart_item ){ if ( ! empty( $cart_item['booking'] ) ) { $date_format = apply_filters( 'woocommerce_bookings_date_format', wc_date_format() ); $time_format = apply_filters( 'woocommerce_bookings_time_format', ', ' . wc_time_format() ); $end_date = apply_filters( 'woocommerce_bookings_get_end_date_with_time', date_i18n( $date_format, $cart_item['booking']['_end_date'] ) ); $item_data[] = array( 'key' => __( 'End Rental Period', 'your-textdomain' ), 'value' => $cart_item['booking']['_end_date'], 'display' => $end_date, ); } return $item_data; }
(source: https://stackoverflow.com/questions/34900999/echo-cart-meta-data-in-woocommerce-woocommerce-bookings)
When the booking/payment is completed, a processing email is sent. Again, only the starting date is mentioned but for legal purposes I need to add the return date as well. How do I do this? I think I need to add a filter in functions.php but I’m not sure.
EDIT: I notice that the booking end date is included when I manually add a booking (without order). So I guess it is not that difficult to implement?
Many thanks in advance.
- The topic ‘Bookings: add return date to order email’ is closed to new replies.