How to add event ticket status on order details page on customer site
In this way, your customers can see the event ticket status on order details page
You need to add the following code on functions.php
if( class_exists( 'YITH_Tickets' ) ) {
if (!function_exists('yith_wcevti_woocommerce_order_item_meta_end_event_ticket')) {
function yith_wcevti_woocommerce_order_item_meta_end_event_ticket($item_id, $item, $order, $status)
{
$product = wc_get_product($item['product_id']);
if ($product && 'ticket-event' == $product->get_type()) {
$event_id = wc_get_order_item_meta($item_id, '_event_id', true);
$ticket_status = get_post_status( $event_id );
$ticket_status = empty($ticket_status) ? 'yith-wcevti-pending-check' : $ticket_status;
if ('yi-checked' == $ticket_status) {
?>
Ticket status: <span class="ticket_status_icon fa fa-thumbs-o-up status_checked"
title="Checked"></span>
<?php
} elseif ('yi-cancelled' == $ticket_status) {
?>
Ticket status: <span class="ticket_status_icon fa fa-ban status_cancelled" title="Cancelled"></span>
<?php
} else {
?>
Ticket status: <span class="ticket_status_icon fa fa-hand-paper-o status_pending_check"
title="Pending check"></span>
<?php
}
}
}
add_action('woocommerce_order_item_meta_end', 'yith_wcevti_woocommerce_order_item_meta_end_event_ticket', 999, 4);
}
}
You obtain the result showed in the followed image: