• Is there a way to add a VAT row before the total as we legally require it? Currently the sheets just display the subtotal preshipping and then shipping and total.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Vishal Kothari

    (@ashokrane)

    Hi @georgeince,

    You can add a VAT row. Please edit the function wcdn_content in includes/wcdn-template-functions.php file.

    In that, make the below changes. Add this line, which attaches the function to the WooCommerce filter.

    add_filter( 'woocommerce_get_order_item_totals', 'wcdn_add_vat', 40, 2 );

    The function body looks like below:

    function wcdn_add_vat( $total_rows, $order ) {
    
    	$wdn_order_currency = ( version_compare( get_option( 'woocommerce_version' ), '3.0.0', ">="  ) ) ? $order->get_currency() : $order->get_order_currency();
    		
    	// replace the amount here with the actual VAT
    	$vat_amount  = 15.50;
    	$vat_display = wc_price( $vat_amount, array( 'currency' => $wdn_order_currency ) );
    
    	$vat_row[ 'VAT' ][ 'label' ] = 'VAT';
    	$vat_row[ 'VAT' ][ 'value' ] = $vat_display;
    
    	$updated_order_total = $order->get_total() + $vat_amount;
    	$total_rows['order_total']['value'] = wc_price( $updated_order_total, array( 'currency' => $wdn_order_currency ) );
    
    	$total_rows = $vat_row + $total_rows;
    
    	return $total_rows;
    }

    This is how the invoice will appear after the above changes: https://screencast.com/t/bqMeJr31hL

    :Vishal

    Thread Starter georgeince

    (@georgeince)

    Is there a way for VAT to be automatically inserted or else I will have to manually edit the plugin file for every order.

    Thank you

    Plugin Author Vishal Kothari

    (@ashokrane)

    How is VAT setup on your store? Having a look at some of the settings for that will help me give you a way to automatically fetch that (if possible).

    :Vishal

    Thread Starter georgeince

    (@georgeince)

    VAT is set using the basic WooCommerce functionality. Prices stated exclude VAT, VAT is then added on during checkout, and shipping has VAT.

    Plugin Author Vishal Kothari

    (@ashokrane)

    Ok. I will check on this & get back to you by tomorrow.

    :Vishal

    Hi, has a resolution been found for this? I am looking to add the same breakdown.

    Thanks

    Thread Starter georgeince

    (@georgeince)

    I too am still waiting for the code to enable the VAT amounts to be automatically entered.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘VAT Breakdown’ is closed to new replies.