Discounts and Coupons in combination with Tax

  • Posts: 12
  • Thank you received: 2
11 years 7 months ago #99726

I'm affraid I cant understand how HikaShop is calulating the price of a product in relation to discounts, coupons and tax.
My settings are set to apply discounts before tax.

I have 5% tax on products in the EU
I have a discount of 4.763% for products in the EU (to cancel out the VAT)

This works fine.
Ie. €45,95 (ExVAT price) * 0.95237 (we pay the VAT discount) * 1.05 (VAT) = €45,95

However problems start when I add a coupon which offers 15% off.
The coupon is set to default behaviour and is for 15%

When added to the €45,95 product example above the price comes out as €39,39 (including what it states is €1,86 for VAT)
????

The only way I can achieve this (when calculating on paper) is as follows:

Apply the 4.763% discount to the coupon (15%) i.e. 14.28555% off
Then apply this to the ExVAT price: 45.95 * 0.8571445 = 39.385 (rounds up to 39.39)
VAT is then ignored (but is retrospectively calulated from the figure above for display purposes)

Obviously this is very wrong.

If I've done something wrong - great - please let me know how to fix the issue with configurations etc.
However If I'm right (and since the discount without coupon is fine, I suspect this is more likely) - there is a serious issue and it needs to be fixed.
Creating a discount to couter act the VAT is perhaps unusual, but the same issue would occur if you needed to apply a trade discount first, and then offered your trade customers a coupon - perhaps a more common senareo.

This is a fairly time sensitive issue for me as the site that uses HikaShop was to launch their coupon to customers today, but cannot until we work this out.
If you can respond to this issue quickly, it would be appreciated.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 7 months ago #99847

Hi,

There is not enough information to tell for sure what to do but I think that the problem is that you didn't select a tax category for your coupon and because of that the tax is indeed ignored for the coupon as you stated since you configured the discounts (and thus coupons too) to apply before the taxes.
Rest assured that the system works fine as far as we know regarding coupons and taxes, as long as you configure it like you want it to behave.

Please Log in or Create an account to join the conversation.

  • Posts: 12
  • Thank you received: 2
11 years 7 months ago #99912

Thanks for the info re: config of tax on coupons. I've set tax rate on the coupon to the default tax rate and it now calculates correctly.
I had thought that because discounts do not have a tax setting, and that because I wanted the discount to be applied to the ex-tax price (ie - to apply to it before the tax was calulated) that the setting was eroneous. Now I know - all is well. A few tooltips in these sorts of areas would be greatly appreciated.

One thing that would be really nice, is if the coupon showed on the cart module.
I don't have the full cart shown through out my checkout process as it doesn't fit with the design of the site - however the cart module is very useful.
However - although the discounts are shown at a product level, the coupon is not displayed, and the total remains uneffected.
Is there an easy way for this to be changed?

Finally, thanks for a great product.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 7 months ago #100006

If you click on the "help" button at the top of each screen, you will get the help relative to the screen where you are and there is an explanation for each field, like you would have with tooltips.

Coupons are only loaded during the checkout, which is why the cart module doesn't display coupons, nor shipping nor payment fees since it usually can't.
It's possible to edit the code of the cart module to add the coupon display. You can edit the file "cart" of the view "product" via the menu Display->Views to add custom code for that.

Please Log in or Create an account to join the conversation.

  • Posts: 12
  • Thank you received: 2
11 years 7 months ago #100559

For anyone else interested in adding coupon calculation to their cart add the following code to the cart.php template around line 210 just before the terminating TFOOT tag.

<?php 
		$app = JFactory::getApplication();
		$coupon_code = $app->getUserState( HIKASHOP_COMPONENT.'.coupon_code','');
		if( strlen($coupon_code) ){
			$extracells = ($this->params->get('show_cart_delete',1)) ? '<td></td>' : '';
			$extracells .= ($row_count<2) ? '<td></td>' : '';
			$class = hikashop_get('class.cart');
			$cart = $class->loadFullCart();
			$this->row=$cart->coupon->total;
			$grandtotal = $this->loadTemplate();
			
			$this->row=new stdClass();
			$this->row->prices = array();
			$this->row->prices[0]  = new stdClass();
			$this->row->prices[0]->price_value 		= -1 * $cart->coupon->discount_value_without_tax;
			$this->row->prices[0]->price_value_with_tax 	= -1 * $cart->coupon->discount_value;
			$this->row->prices[0]->price_currency_id 	= $cart->coupon->discount_currency_id;
			$discountvalue = $this->loadTemplate();
			
			echo '<tr><td colspan="'.$row_count.'"><hr /></td></tr>
			<tr><td class="hikashop_cart_module_product_total_title" colspan="'.$colspan.'">'.JText::_('HIKASHOP_COUPON').' ('.$cart->coupon->discount_code.')</td>
			<td class="hikashop_cart_module_product_total_value"><span class="hikashop_product_price_full"><span class="hikashop_product_price hikashop_product_price_0">'.$discountvalue.'</span></span></td>
			'.$extracells.'</tr>
			<tr><td colspan="'.$row_count.'"><hr /></td></tr>
			<tr><td class="hikashop_cart_module_product_total_title" colspan="'.$colspan.'"><b>'.JText::_('HIKASHOP_TOTAL').'</b></td>
			<td class="hikashop_cart_module_product_total_value"><span class="hikashop_product_price_full"><span class="hikashop_product_price hikashop_product_price_0">'.$grandtotal.'</span></span></td>
			'.$extracells.'</tr>';
		}
?>

Last edit: 11 years 7 months ago by scarlettgowing.
The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

Time to create page: 0.059 seconds
Powered by Kunena Forum