Support » Plugin: Advanced Order Export For WooCommerce » Add tax percentage and net amount to export

  • Resolved spirit1977

    (@spirit1977)


    Hi,

    Is it possible to add columns for the tax percantage to orders and the net amount without tax?

    In my shop we are selling products with 7% tax and 19% tax (it’s a special with taxes in Germany). And I have orders with both percentage but I can’t find a way to show these in the export.
    What I also miss in the export is the net total order amount.

    Do you have an idea to solve this?

    Thanks

    Mark

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author algol.plus

    (@algolplus)

    hi Mark

    Section “Setup Fields”, scroll down to “Products”, click button “Setup Fields”.
    you will see field “line_no_tax”.

    net total order amount — without shipping ?

    Do you want to display tax rate for each product?
    thanks, alex

    Thread Starter spirit1977

    (@spirit1977)

    Hi Alex,

    Thanks. I would rather like to have these additional columns:
    net incl. shipping per tax rate

    For example:

    column A (net incl. shipping): 100
    column B (net tax amount taxe rate A): 12
    column C (net tax amount taxe rate B): 21

    Her a link to n invoice from an WC order: https://www.dropbox.com/s/7glvr4501y7n30o/Rechnung-SAL-RG-01269.pdf?dl=0

    There you can see the different tax rates and amounts.

    Thanks

    Mark

    Plugin Author algol.plus

    (@algolplus)

    ok, I’ll provide some code tomorrow

    Plugin Author algol.plus

    (@algolplus)

    here is column A (net incl. shipping): 100

    // add shipping + subtotal
    add_filter('woe_get_order_fields', 'woe_addd_shipping_plus_subtotal' );
    function woe_addd_shipping_plus_subtotal($fields) {
    	$fields['order_shipping_plus_subtotal'] = array('segment'=>'cart','label'=>'Order amount without tax','colname'=>'Order amount without tax','value'=>'','checked'=>1);
    	return $fields;
    }
    add_filter('woe_get_order_value_order_shipping_plus_subtotal','woe_fill_order_shipping_plus_subtotal', 10, 3);
    function woe_fill_order_shipping_plus_subtotal($value, $order, $field) {
    	return $order->get_total_shipping() + $order->get_subtotal();
    }
    // end add shipping + subtotal
    
    Plugin Author algol.plus

    (@algolplus)

    add all taxes

    class WOE_add_all_taxes{
    	var $taxes;
    	
    	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);
    	}	
    	
    	function add_order_fields($fields) {
    		global $wpdb;
    		
    		$taxes = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}woocommerce_tax_rates");
    		foreach($taxes  as $tax) {
    			$fields['tax_'.$tax->tax_rate_id] = array('label'=>$tax->tax_rate_name,'checked' => 1, 'segment'=>'cart','colname'=>$tax->tax_rate_name);
    			add_filter('woe_get_order_value_tax_'.$tax->tax_rate_id, array($this,'get_tax_value'), 10, 3);
    		}	
    		return $fields;
    	}
    	
    
    	function fetch_order_taxes($order_id) {
    		//reset values
    		$this->taxes = array();
    		//read taxes
    		$order = new WC_Order($order_id);
    		foreach ( $order->get_items('tax') as $item_id=>$item ) {
    			// must add shipping taxes  
    			$this->taxes['tax_'.$item['rate_id'] ] =  $item['tax_amount'] + $item['shipping_tax_amount'];
    		}
    	}
    	
    	function get_tax_value($value, $order,$field) { 
    		return isset($this->taxes[$field]) ? $this->taxes[$field] : 0;
    	}
    }	
    new WOE_add_all_taxes();
    
    Thread Starter spirit1977

    (@spirit1977)

    Many thanks

    Thread Starter spirit1977

    (@spirit1977)

    Hi Alex, the snippet no longer works. When it’s activated the export is empty, when it’s deactivated export works. Do you have an idea why?

    Plugin Author algol.plus

    (@algolplus)

    hi Mark

    please, use fresh code from https://algolplus.com/plugins/code-samples/
    it must work

    thanks, Alex

    Thread Starter spirit1977

    (@spirit1977)

    Thanks 🙂

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Add tax percentage and net amount to export’ is closed to new replies.