Thank you for fast reply. Unfortunately I can not get it.
class WOE_Bookings{
function __construct() {
add_filter('woe_get_order_product_fields',array($this,'add_product_fields') );
add_filter('woe_get_order_product_item',array($this,'fetch_booking') );
add_filter('woe_get_persons_count', array($this, 'get_pax_count'), 10, 4 );
}
function add_product_fields($fields) {
$fields['# of Persons'] = array('label'=>'# of Persons','colname'=>'# of Persons','checked'=>1,'segment'=>'cart');
return $fields;
}
// booking for item
function fetch_booking($item) {
global $wpdb;
$this->booking = false;
$booking_id = $wpdb->get_var( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key= '_booking_order_item_id' AND meta_value=" . intval( $item->get_id() ) );
if( $booking_id ) {
$this->booking = new WC_Booking($booking_id);
}
return $item;
}
//count pax
function get_pax_count($person_count) {
$person_count = array_sum( $this->booking->get_person_counts() );
return $person_count;
}
}
new WOE_Bookings();