I am using the code as posted by Atlea. Copied below which corrects the sub totals and vat for use in the UK. Also by marking the shipping line item as hidden, that gets rid of the shipping/delivery showing up with the item purchased.
But I have one last problem, it would seem that the code below must function after the commerce_email module has collected its info on the line items.
Therefore the e mail that is sent to the customer and shop admin still shows the sub total net of vat, the shipping line item & in the wrong order.
To see more about the background problem here is a link. http://drupal.org/node/1352916
Does anyone know how to change the email code to reflect the changes and also remove the shipping line item from the email
Any help would be very welcome as I have two sites wanting this
--------------------------------------------------------------------------------
.
function ukvat_commerce_price_formatted_components_alter(&$components, $item, $entity) {
$tax_rates = commerce_tax_rates();
foreach ($tax_rates as $tax_rate) {
if ($tax_rate['type'] == 'vat') {
if (isset($components['base_price'])) {
// Add value added tax to the subtotal
$amount = $components['base_price']['price']['amount'] * (1 + $tax_rate['rate']);
$components['base_price']['price']['amount'] = commerce_tax_rate_round_amount($tax_rate, $amount);
}
if (isset($components['flat_rate_delivery'])) {
// Add value added tax to the shipping
$amount = $components['flat_rate_delivery']['price']['amount'] * (1 + $tax_rate['rate']);
$components['flat_rate_delivery']['price']['amount'] = commerce_tax_rate_round_amount($tax_rate, $amount);
}
}
}
}
function ukvat_commerce_price_component_type_info_alter(&$component_types) {
if (isset($component_types['flat_rate_delivery']) && isset($component_types['base_price'])) {
// Place shipping below base_price
$component_types['flat_rate_delivery']['weight'] = $component_types['base_price']['weight'] + 1;
}
}
Comments
Comment #1
Summit CreditAttribution: Summit commentedHi,
This post is more then a year old!
Has nobody since then be able to get to this please.
I had emailcontact with remus1 and we both think it is unbelievable that no correct email can be sent to clients using European VAT rules.
Just using;
- total excl VAT
- shipping excl. VAT
- VAT
- Total incl. VAT
Is this module still maintained? Should I look to alternatives to get this working?
Greetings,
Martijn
Comment #2
Summit CreditAttribution: Summit commentedHi,
Anyone used https://drupal.org/project/commerce_eu_vat already?
Greetings, Martijn
Comment #3
rszrama CreditAttribution: rszrama at Centarro commented