Title: Tax Names
Last modified: September 8, 2016

---

# Tax Names

 *  Resolved [dwdonline](https://wordpress.org/support/users/dwdonline/)
 * (@dwdonline)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/tax-names/)
 * We currently have three different tax rates. GST, HST, and QST. I only see an
   option to get the tax total. I need to be able to have a column for each Tax 
   Name and it have the amount charged. So potentially, an order could be charged
   three different taxes, and I need to be able to separate those into columns.

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/tax-names/#post-8162340)
 * yes, I’ve got your email and sample file.
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/tax-names/#post-8162582)
 * 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();
       ```
   
 *  Thread Starter [dwdonline](https://wordpress.org/support/users/dwdonline/)
 * (@dwdonline)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/tax-names/#post-8162736)
 * I just added the above code to my functions.php file. It adds the fields to the
   export, but they all have 0 in them instead of the tax values.
 * In the woocommerce_order_items table it looks like this: [https://snag.gy/60VNov.jpg](https://snag.gy/60VNov.jpg)
 * In the woocommerce_order_itemmeta table, it has this: [https://snag.gy/A5SuMJ.jpg](https://snag.gy/A5SuMJ.jpg)
 * We are using the standard WooCommerce tax rates Admin > WooCommerce > Settings
   > Tax > Standard Rates.
 * This is the tax table: [https://snag.gy/TVu3r4.jpg](https://snag.gy/TVu3r4.jpg)
    -  This reply was modified 9 years, 8 months ago by [dwdonline](https://wordpress.org/support/users/dwdonline/).
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/tax-names/#post-8163329)
 * some hooks were added in beta version, so provided code works in beta only.
 * you can contact me if you need it.
    -  This reply was modified 9 years, 8 months ago by [algol.plus](https://wordpress.org/support/users/algolplus/).
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/tax-names/#post-8338463)
 * Code works since version 1.2.2
 *  [leono77](https://wordpress.org/support/users/leono77/)
 * (@leono77)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/tax-names/#post-8697861)
 * Hi,
 * Thanks for this solution. I have two additional questions:
 * Do i place this code in functions.php of my child theme?
 * I need to slightly adjust the code:
    My tax names in Woocommerce are ‘**BTW Hoog**‘
   and ‘**BTW Laag**‘. So they contain a whitespace.
 * What code do i need to use for BTW Hoog? For example here:
    var $gst_tax = 0;
   var $hst_tax = 0;
 * because simply replacing ‘gst’ by ‘BTW Hoog’ does not work:
    var $BTW Hoog_tax
   = 0; var $BTW Laag = 0;
 * I have two tax rates and i want to export each in a separate column.
    Thank you
   in advance.
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/tax-names/#post-8700122)
 * hi
 * Yes, you must put it in in functions.php of child theme
 * You must replace space with “_” , look at the updated code
 *     ```
       class WOE_multi_taxes_order{
       	var $BTW_Hoog = 0;
       	var $BTW_Laag = 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_BTW_Hoog',array($this,'get_BTW_Hoog'), 10, 2);
       		add_filter('woe_get_order_xls_value_BTW_Laag',array($this,'get_BTW_Laag'), 10, 2);
       	}	
   
       	function add_order_fields($fields) {
       		$fields['BTW_Hoog'] = array('label'=>'BTW Hoog','checked' => 1, 'segment'=>'','colname'=>'BTW Hoog');
       		$fields['BTW_Laag'] = array('label'=>'BTW Laag','checked' => 1, 'segment'=>'','colname'=>'BTW Laag');
       		return $fields;
       	}
   
       	function fetch_order_taxes($order_id) {
       		//reset values
       		$this->BTW_Hoog = $this->BTW_Laag = 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'] == 'BTW Hoog')$this->BTW_Hoog =  $item['tax_amount'] + $item['shipping_tax_amount']; 
       			if($item['label'] == 'BTW Laag')$this->BTW_Laag =  $item['tax_amount'] + $item['shipping_tax_amount'];
       		}
       	}
   
       	function get_BTW_Hoog($value, $order) {  return $this->BTW_Hoog; }
       	function get_BTW_Laag($value, $order) {  return $this->BTW_Laag; }
       }	
       new WOE_multi_taxes_order();
       ```
   

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Tax Names’ is closed to new replies.

 * ![](https://ps.w.org/woo-order-export-lite/assets/icon-256x256.png?rev=1365554)
 * [Advanced Order Export For WooCommerce](https://wordpress.org/plugins/woo-order-export-lite/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woo-order-export-lite/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woo-order-export-lite/)
 * [Active Topics](https://wordpress.org/support/plugin/woo-order-export-lite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woo-order-export-lite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woo-order-export-lite/reviews/)

## Tags

 * [taxes](https://wordpress.org/support/topic-tag/taxes/)

 * 7 replies
 * 3 participants
 * Last reply from: [algol.plus](https://wordpress.org/support/users/algolplus/)
 * Last activity: [9 years, 3 months ago](https://wordpress.org/support/topic/tax-names/#post-8700122)
 * Status: resolved