A Tip for UK/European Developers regarding Vatable & Non-Vatable Goods and Shipping
Here in the UK if the goods that are being sold are subject to VAT and the company selling them are registered for vat then the carriage charge is also subject to VAT, but what if there are also goods being sold (in the case of the site I am working on children's clothes) that are not subject to VAT, how do you get eCart to add the VAT correctly ?
First of all you need to have a column in your database that denotes whether the product is vatable or not and a column in the eCart object to store this value in as per Jason's advice in this thread
Also make sure that the include shipping in cart subtotal when calculating sales tax checkbox under the shipping tab is checked.
When shipping to an address within the EU you must charge vat so I have a tax rule called EU Tax Calc that checks the for the existence of the session variable $_SESSION['eCartCheckoutForm_country'] and then checks the value to see whether the country being shipped to is within the EU. If the address is within the EU then we have to charge VAT
So the first rule in the Tax id the Standard Check that the number of unique items in the cart is greater than zero and then we check the session variable as described above.
For the Calculation choose Flat rate and paste this code into the box
((($this->GetTaxableTotal()) - ($this->ConditionalTotal("TotalPrice", "Taxable", "0"))) * 0.175)
What this code does is subtracts the non vatable portion of the order from the taxable total and then calculates the VAT due on the remainder (plus shipping)
I hope that helps somebody else who finds themselves in this situation.
The entire eCart rule should look like this in your eCart file
//eCart Rule
function WAEC_eCart1_EUTaxCalc() {
$totalTax = 0;
if (true && ((sizeof($this->Items) > 0) && (isset($_SESSION['eCartCheckoutForm_shipping_country'])) && ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "GB") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "BE") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "BG") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "CZ") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "DK") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "DE") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "EE") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "GR") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "ES") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "FR") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "IE") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "IT") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "CY") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "LV") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "LT") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "LU") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "HU") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "MT") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "NL") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "AT") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "PL") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "PT") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "RO") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "SI") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "SK") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "FI") || ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "SE"))) {
$totalTax += ((($this->GetTaxableTotal()) - ($this->ConditionalTotal("TotalPrice", "Taxable", "0"))) * 0.175);//Result
}
return WA_eCart_FormatNumber($totalTax, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule