Tribe__Tickets_Plus__Commerce__WooCommerce__Main::add_tickets_msg_to_email( WC_Order $order )
Adds a message to WooCommerce’s order email confirmation.
Contents
Parameters
- $order
-
(WC_Order) (Required)
Source
File: src/Tribe/Commerce/WooCommerce/Main.php
public function add_tickets_msg_to_email( $order ) {
$order_items = $order->get_items();
// Bail if the order is empty
if ( empty( $order_items ) ) {
return;
}
$has_tickets = false;
// Iterate over each product
foreach ( (array) $order_items as $item ) {
$product_id = isset( $item['product_id'] ) ? $item['product_id'] : $item['id'];
// Get the event this tickets is for
$post_id = get_post_meta( $product_id, $this->event_key, true );
if ( ! empty( $post_id ) ) {
$has_tickets = true;
break;
}
}
if ( ! $has_tickets ) {
return;
}
echo '<br/>' . apply_filters( 'wootickets_email_message', esc_html__( "You'll receive your tickets in another email.", 'event-tickets-plus' ) );
}