News:

Support the VirtueMart project and become a member

Main Menu

Coupon with percentage discount and VAT

Started by ZeroPointLabs, May 22, 2015, 11:58:39 AM

Previous topic - Next topic

ZeroPointLabs

VirtueMart 3.0.8, Joomla 3.4.1

I've got the following order








ItemEx Tax PriceTaxRow Total
Product A   500 EUR115 EUR615 EUR
Product B500 EUR115 EUR615 EUR
Subtotal1000 EUR   230 EUR   1230 EUR   
Shipping100 EUR23 EUR123 EUR
Total1100 EUR253 EUR1353 EUR

All is good and this is supported by the following variable values










$this->cart->cartPrices['basePrice']1000
$this->cart->cartPrices['taxAmount']230
$this->cart->cartPrices['salesPrice']1230
$this->cart->cartPrices['shipmentValue']100
$this->cart->cartPrices['shipmentTax']23
$this->cart->cartPrices['salesPriceShipment']123
$this->cart->cartPrices['billTaxAmount']253
$this->cart->cartPrices['billtotal']1353

I have the following coupon defined, which should give the shopper 10% off their order









CouponMYCOUPON
Value10.00000
Percentage or TotalPercent
Coupon TypePermanent Coupon
Minimum total Order0.00000
Coupon Start Date- Never -
Coupon Expiry Datesome time in future

when I apply the coupon to the order I would expect this (My testing shows that the discount is a percentage of the subtotal, so doesn't include the shipping costs)









ItemEx Tax PriceTaxRow Total
Product A   500 EUR115 EUR615 EUR
Product B500 EUR115 EUR615 EUR
Subtotal1000 EUR   230 EUR   1230 EUR   
Shipping100 EUR23 EUR123 EUR
Coupon-100 EUR-23 EUR-123 EUR
Total1000 EUR230 EUR1230 EUR

When I look at the cart on screen and the variables that support this, it doesn't look quite right












$this->cart->cartPrices['basePrice']1000
$this->cart->cartPrices['taxAmount']230
$this->cart->cartPrices['salesPrice']1230
$this->cart->cartPrices['shipmentValue']100
$this->cart->cartPrices['shipmentTax']23
$this->cart->cartPrices['salesPriceShipment']123
$this->cart->cartPrices['couponTax']0
$this->cart->cartPrices['salesPriceCoupon']-123
$this->cart->cartPrices['billTaxAmount']228.13
$this->cart->cartPrices['billtotal']1230

The value of 228.13 for $this->cart->cartPrices['billTaxAmount'] was initially a bit puzzling, but it turns out that it is the tax based on a bill total of $1220. i.e. it looks like the discount might be applied twice, once as a percentage and once as an absolute value. Well at least for the purpose of calculating the billTaxAmount.