Sales Tax for Items Picked Up vs Shipped

  • Posts: 49
  • Thank you received: 2
12 years 9 months ago #70107

Good day,

If a product is shipped, the tax is charged based upon the ship to address. However, if the product is picked up by the customer, the tax would be collected based upon the point of pickup, which is an override per se`

For example: the customer lives in Milwaukee County which has a 5.6% sales tax. Because the customer is going to pick up the product in Sheboygan County, the sales tax rate should be 5%. Is this configurable or would require a code change? I'd like to tie the override to the shipping method if possible.

Thanks,
Kurt

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

  • Posts: 13201
  • Thank you received: 2322
12 years 9 months ago #70228

Hi Cyngen,

In the Shipping method configuration, you can set the option "Override shipping address" to "Your shop address" it will override the address of the customer.
You can too change the tax category of the shipping method.

Last edit: 12 years 9 months ago by Xavier.

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

  • Posts: 49
  • Thank you received: 2
12 years 9 months ago #70336

Xavier wrote: Hi Cyngen,

In the Shipping method configuration, you can set the option "Override shipping address" to "Your shop address" it will override the address of the customer.
You can too change the tax category of the shipping method.


I did all that and I'm not getting sales tax to show up properly. I will include screen shots of what I've configured. The technique should also override all other tax codes including 'out of state' which is zero tax if ordered and shipped there -- except anyone that has a tax exempt number on file.

1. Setup of Shop address



2. Setup Tax Zones -- Each County within the State of Wisconsin can have a different sales tax rate. Based upon Nicolas' input, this was setup. There are 73 tax zones setup, one for each County plus 'out of state'.



3. Tax rules have been established and work fine based upon the customers address.



4. Manual Shipping Method - Customer pickup configured.



5. Custom fields reconfigured per discussion with Nicolas. The address_country is now 'state' and each state is in the Country zone. The address_state is now 'county'.




Based upon the customer address for shipping with the county set correctly, the sales tax computes properly. I do not get the tax computed properly from the pickup shipping. Thoughts? Where did I misconfigure?

Thanks,
Kurt

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

  • Posts: 13201
  • Thank you received: 2322
12 years 9 months ago #70462

Hi Kurt,

The tax calculation depending on the shop address was not planned in HikaShop.
Can you try to replace the function hikashop_getZone() by the following function in "youSite\administrator\components\com_hikashop\helpers\helper.php":

function hikashop_getZone($type='shipping'){
	$app = JFactory::getApplication();
	$shipping_address=$app->getUserState( HIKASHOP_COMPONENT.'.'.$type.'_address',0);
	$zone_id =0;
	if(!empty($shipping_address)){
		$useMainZone=false;
		$id = $app->getUserState( HIKASHOP_COMPONENT.'.shipping_id','');
		if($id){
			$class = hikashop_get('class.shipping');
			$shipping = $class->get($id);
			$params = unserialize($shipping->shipping_params);
			$override = 0;
			if(isset($params->shipping_override_address)) {
				$override = (int)$params->shipping_override_address;
			}
			if($override){
				$useMainZone=true;
			}
		}
		if(!$useMainZone){
			//TODO improve that so that we don't do the query all the time
			$addressClass = hikashop_get('class.address');
			$address = $addressClass->get($shipping_address);
			if(!empty($address)){
				$field = 'address_country';
				if(!empty($address->address_state)){
					$field = 'address_state';
				}
				static $zones = array();
				if(empty($zones[$address->$field])){
					$zoneClass = hikashop_get('class.zone');
					$zones[$address->$field] = $zoneClass->get($address->$field);
				}
				if(!empty($zones[$address->$field])){
					$zone_id = $zones[$address->$field]->zone_id;
				}
			}
		}
	}

	if(empty($zone_id)){
		$zone_id =$app->getUserState( HIKASHOP_COMPONENT.'.zone_id', 0 );
		if(empty($zone_id)){
			$config =& hikashop_config();
			$zone_id = explode(',',$config->get('main_tax_zone',$zone_id));
			if(count($zone_id)){
				$zone_id = array_shift($zone_id);
			}else{
				$zone_id=0;
			}
			$app->setUserState( HIKASHOP_COMPONENT.'.zone_id', $zone_id );
		}
	}
	return (int)$zone_id;
}

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

  • Posts: 49
  • Thank you received: 2
12 years 9 months ago #70508

I will give this a whirl and report back. This might be a good future item to include in Hikashop. I have a few clients that would benefit from this.

Thank you... as always fast good support from Hikashop.

Kurt

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

  • Posts: 49
  • Thank you received: 2
12 years 9 months ago #70554

Made the change and tested. Same result. I get the tax rate as setup by the customer address.

Is there something I should be setting other than the check box for the Shop Address in the shipping module for the shipping method? How will it know the county, etc based upon my setup to know to use the correct sales tax rate.

If needed, I'll be more than happy to provide back end access to review things.

Kurt

Last edit: 12 years 9 months ago by Cyngen. Reason: Added more info and question

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

  • Posts: 13201
  • Thank you received: 2322
12 years 9 months ago #70738

Can you try with this code:

function hikashop_getZone($type='shipping'){
	$app = JFactory::getApplication();
	$shipping_address=$app->getUserState( HIKASHOP_COMPONENT.'.'.$type.'_address',0);
	$zone_id =0;
	if(!empty($shipping_address)){
		$useMainZone=false;
		$id = $app->getUserState( HIKASHOP_COMPONENT.'.shipping_id','');
		if($id){
			$class = hikashop_get('class.shipping');
			$shipping = $class->get($id);
			$params = unserialize($shipping->shipping_params);
			$override = 0;

			if(isset($params->shipping_override_address)) {
				$override = (int)$params->shipping_override_address;
			}
			if($override){
				$config =& hikashop_config();
				$zone_id = explode(',',$config->get('main_tax_zone',$zone_id));
				if(count($zone_id)){
					$zone_id = array_shift($zone_id);
				}else{
					$zone_id=0;
				}
				return $zone_id;
			}
		}

		//TODO improve that so that we don't do the query all the time
		$addressClass = hikashop_get('class.address');
		$address = $addressClass->get($shipping_address);
		if(!empty($address)){
			$field = 'address_country';
			if(!empty($address->address_state)){
				$field = 'address_state';
			}
			static $zones = array();
			if(empty($zones[$address->$field])){
				$zoneClass = hikashop_get('class.zone');
				$zones[$address->$field] = $zoneClass->get($address->$field);
			}
			if(!empty($zones[$address->$field])){
				$zone_id = $zones[$address->$field]->zone_id;
			}
		}

	}
	if(empty($zone_id)){

			$zone_id =$app->getUserState( HIKASHOP_COMPONENT.'.zone_id', 0 );

		if(empty($zone_id)){
			$config =& hikashop_config();
			$zone_id = explode(',',$config->get('main_tax_zone',$zone_id));
			if(count($zone_id)){
				$zone_id = array_shift($zone_id);
			}else{
				$zone_id=0;
			}
			$app->setUserState( HIKASHOP_COMPONENT.'.zone_id', $zone_id );
		}
	}
	return (int)$zone_id;
}

It tried on my end and it seems to be working fine.

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

  • Posts: 49
  • Thank you received: 2
12 years 9 months ago #70784

Replaced the code and tests. No tax is showing up ... Now, could there be some other configuration I'm not following properly?

I can give you backend and ftp access to the site to take a look. I'm sure it's something very simple and perhaps taking a look at it will help you help me :whistle:

Attached is the shopping cart after shipping has been selectd. No tax is showing and it should be 5%.




I can supply credentials via PM.

Attachments:
Last edit: 12 years 9 months ago by Cyngen.

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

  • Posts: 84102
  • Thank you received: 13638
  • MODERATOR
12 years 8 months ago #70823

Yes, please supply credentials to Xavier via PM.

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

  • Posts: 49
  • Thank you received: 2
12 years 8 months ago #70825

Thanks, Information has been sent.

Kurt

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

  • Posts: 13201
  • Thank you received: 2322
12 years 8 months ago #70894

Ok, it's seems to be working fine now.

You just had to set a state for the main zone instead of the Wisconsin country.

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

  • Posts: 49
  • Thank you received: 2
12 years 8 months ago #70899

OK Great, I see it showing at the proper percentage however... i see two issues yet that may or may not be related here:

1. The sales tax is not correct. At 5% on $294.00 should be $14.70 and it's calculated as $14

2. The sales tax is not being added into the total.

See the screen shot I've included. Great progress thus far and i'm thankful for the help.

Kurt

Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
12 years 8 months ago #70903

Just tried on my end and the price is correct for me:



The sales tax is already included in the final total, it's just an overview of the informations for the final total.

Attachments:

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

  • Posts: 49
  • Thank you received: 2
12 years 8 months ago #70904

Xavier,

The tax should be $1.05 at a 5% rate not $1.00

Also note, the tax isn't added into the final total

Thank you,
Kurt

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

  • Posts: 13201
  • Thank you received: 2322
12 years 8 months ago #70913

The product price is $2, 5% of $2 = $0.10. so the product price with tax is $2.10.

The taxes are included immediately in the product price, that's why the total price and the final total price are the same.

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

  • Posts: 49
  • Thank you received: 2
12 years 8 months ago #70915

My little light bulb clicked on here. Ok, So can we do this without the tax showing on the product?

In my example:
Northern - 10 pounds - $28 per pound would give an extended price of $280.
Then add in the shipping if any.
Then compute the tax
Then sum the above three for the Final Total

I thought there was an option???

Great work on helping me with this.

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

  • Posts: 49
  • Thank you received: 2
12 years 8 months ago #70961

This has been resolved. Thank you for great support.

Last edit: 12 years 8 months ago by Cyngen.

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

Time to create page: 0.133 seconds
Powered by Kunena Forum