Hi,
Just noticed that,, with product_kit's the VAT is calculated on the price + the discount - on both sell_price and list_price.
However the idea is to ONLY subtract discount on sell_price (list_price is shown without discounts subtracted) - and thus uc_vat calculates the VAT wrongly for list_price.
I'm no longer running your exact version of uc_vat - so here's the modified part - around line 466:
if ($node->type == 'product_kit') {
// Special case for product kits; calculate VAT per-product including any kit discount.
foreach ($node->products as $product) {
foreach ($tax_rates as $tax) {
if (in_array($product->type, $tax->taxed_product_types) && ($tax->shippable == 0 || $product->shippable == 1)) {
// This uses the original sell_price, which will not necessarily be correct if another price alterer is enabled.
// Instead, should we try to proportionally back-calculate the individual product prices from the price we were passed?
if ($context['field'] == 'list_price') //We don't subtract discount on list_price
$price['price'] += ($product->sell_price) * $product->qty * $tax->rate;
else
$price['price'] += ($product->sell_price + $product->discount) * $product->qty * $tax->rate;
$suffixes[$tax->id] = $tax->name;
}
}
}
}
Comments
Comment #1
longwaveCommitted. Still not sure if product kit support works as expected, but this makes it a bit better!
Comment #3
grub3 commentedSubscribe.