code to get order taxes ( above line “Order Total:”)
class WOE_multi_taxes_order{
var $gst_tax = 0;
var $hst_tax = 0;
var $qst_tax = 0;
function __construct() {
add_filter('woe_get_order_fields', array($this,'add_order_fields'), 10, 1);
add_filter('woe_order_export_started',array($this,'fetch_order_taxes'), 10, 1);
//for XLS , woe_get_order_{$format}_value_{$field}
add_filter('woe_get_order_xls_value_gst_tax',array($this,'get_gst_tax'), 10, 2);
add_filter('woe_get_order_xls_value_hst_tax',array($this,'get_hst_tax'), 10, 2);
add_filter('woe_get_order_xls_value_qst_tax',array($this,'get_qst_tax'), 10, 2);
}
function add_order_fields($fields) {
$fields['gst_tax'] = array('label'=>'TAXES GST','checked' => 1, 'segment'=>'','colname'=>'TAXES GST');
$fields['hst_tax'] = array('label'=>'TAXES HST','checked' => 1, 'segment'=>'','colname'=>'TAXES HST');
$fields['qst_tax'] = array('label'=>'TAXES QST','checked' => 1, 'segment'=>'','colname'=>'TAXES QST');
return $fields;
}
function fetch_order_taxes($order_id) {
//reset values
$this->gst_tax = $this->hst_tax = $this->qst_tax = 0;
//read taxes
$order = new WC_Order($order_id);
foreach ( $order->get_items('tax') as $item_id=>$item ) {
// must add shipping taxes
if($item['label'] == 'GST')$this->gst_tax = $item['tax_amount'] + $item['shipping_tax_amount'];
if($item['label'] == 'HST')$this->hst_tax = $item['tax_amount'] + $item['shipping_tax_amount'];
if($item['label'] == 'QST')$this->qst_tax = $item['tax_amount'] + $item['shipping_tax_amount'];
}
}
function get_gst_tax($value, $order) { return $this->gst_tax; }
function get_hst_tax($value, $order) { return $this->hst_tax; }
function get_qst_tax($value, $order) { return $this->qst_tax; }
}
new WOE_multi_taxes_order();