First Visit to Check Out - Tax Not Calculated

  • Posts: 20
  • Thank you received: 0
13 years 9 months ago #7066

Hello,

I apologize if this is already addressed in another thread but I searched and did not find it.

It seems that the first visit for a customer in a zone with a tax rule does not include the taxes. The first time a user adds an item to the cart and they are taken to the check-out view, the taxes are not included. if they hit F5 to refresh the view, or add another item to the cart the taxes are then calculated correctly. This also happens if the user logs out before purchase and then logs back in. The first time they click on Proceed To Checkout the taxes will not be calculated properly. Only after they refresh the check out page again does the tax rule take effect. I don't think this is intentional and the taxes should calculate on the first view of the check out.

thoughts?

thanks,

This is with V1.4.4

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 9 months ago #7074

Hi,

This is probably related to the way you set tax rules and the main tax zone in the configuration of HikaShop:
The main tax zone is outside the zone where taxes are applied. But when you refresh the page, the zone of the user has been set with his address which overrides the main tax zone and now the tax is calculated.

Could you make a screenshot of your tax rules listing, of the checkout without the taxes applied and the value for the main tax zone ?

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

  • Posts: 20
  • Thank you received: 0
13 years 9 months ago #7272

Hello,

Here are the basics of my setup.

1) I set the main tax zone to Antarctica.
2) I created 1 tax rule for Antarctica with 0% tax.
3) I created 1 additional rule for location X with tax = 13%.

The customer account has address information saved for location X. When the customer is logged in and adds the first item to the cart they are taken to the checkout and the tax is not calculated or included in the total. However, the checkout is showing that the address selected is in location X which should have 13% tax applied. If you refresh the checkout view, or add another item to the cart (causing a return to the checkout) the taxes are now shown correctly.

Why does the first visit to the checkout not display the tax. The customers account is setup for a tax zone and the rule exists. The next step for the customer is to checkout which will take them to paypal (for example). Shouldn't Hikashop, if it is automatically selecting the default customer address, calculated and display taxes based on this default address the first time, and everytime, you are taken to the checkout?

thoughts?

thanks very much,

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 9 months ago #7290

We need to have a look at that on our end we might be able to solve the problem.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 9 months ago #7359

If you add the line:
$this->initCart();

after the line:
$this->cart_update = true;

in the function before_address of the file components/com_hikashop/controllers/checkout.php that should solve the problem.

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

  • Posts: 20
  • Thank you received: 0
13 years 9 months ago #7405

in Version 1.4.4 of checkout.php the line "$this->cart_update = true;" is not in the function before_address.

I did find it in functions: after_coupon and after_cart

What modification should I make?

thanks,

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 9 months ago #7406

The function needs to be like that:

function before_address(){
		$status = $this->_checkLogin();
		if($status){
			$user_id = hikashop::loadUser();
			if($user_id){
				$app =& JFactory::getApplication();
				$shipping = $app->getUserState( HIKASHOP_COMPONENT.'.shipping_address',0 );
				if(empty($shipping)){
					
					$db =& JFactory::getDBO();
					$db->setQuery('SELECT address_id FROM '.hikashop::table('address').' WHERE address_published=1 AND address_user_id='.$user_id);
					$address_id = $db->loadResult();
					$app->setUserState( HIKASHOP_COMPONENT.'.shipping_address',$address_id );
					$app->setUserState( HIKASHOP_COMPONENT.'.billing_address',$address_id );
					
					if(strpos($this->checkout_workflow,'shipping')!==false){
						//try to auto select the shipping. If the shipping was selected and that the shipping is on the same step as the previous page, stay on the same page
						if(!$this->before_shipping(true) && $this->_getStep('shipping',$this->previous)!==false){
							$status = false;
						}
					}
					if(strpos($this->checkout_workflow,'payment')!==false){
						//try to auto select the payment. If the payment was selected and that the payment is on the same step as the previous page, stay on the same page
						if(!$this->before_payment(true) && $this->_getStep('payment',$this->previous)!==false){
							$status = false;
						}
					}
					$this->initCart(true);
					$this->cart_update = true;
					$this->initCart();
				}
			}
		}
	}

Last edit: 13 years 9 months ago by nicolas.

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

  • Posts: 20
  • Thank you received: 0
13 years 9 months ago #7409

Thanks for your help,

That seems to have addressed the issue from my initial testing.

Will this update become standard in future releases or do we need to make note of this and apply this change in future revisions?

Last edit: 13 years 9 months ago by nicolas. Reason: remove code and update original

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 9 months ago #7413

Yes, that's the code of the function which will be in next release.

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

Time to create page: 0.078 seconds
Powered by Kunena Forum