Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

tax on shipping based on what?s in cart


Guest

Recommended Posts

Posted

Hi!

 

In Sweden we have a few different tax rates depending on what kind of item it is.

For example the tax rates on books is 6% and on for example on a t-shirt the tax rate is 25%.

 

If an order contains only a book the tax on the shipping should be 6%.

If an order contains only a t-shirt the tax on the shipping should be 25%

If an order contains both books and t-shirts the item wiht the highest order value will descide the tax rate.

 

Can this be coded somehow. Would really appreiciate if somebody could help me with how this can be done.

 

/Per

Posted

Yes, use tax classes/tax rates under Locations/Taxes in the admin.

Please use the forums for support! I am happy to help you here, but I am unable to offer free technical support over instant messenger or e-mail.

Posted

Thanks for your reply :-)

I?m talking about the the tax on the shipping cost. Do you mean I can do this without coding?

Please explain.

Posted

Ah, apologies, I misunderstood. Yes, if you can't find an existing contribution and don't want to just tack it on as a sales tax, you will need to make changes to the codebase.

Please use the forums for support! I am happy to help you here, but I am unable to offer free technical support over instant messenger or e-mail.

Posted

do I need to make the changes in my shipping module (in my case zonez.php) or do I do the changes in "ot_shipping.php"

 

I commented out the following code in zonez.php and it was still calculating the tax.

	  if ($this->tax_class > 0) {
	$this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
  }

 

Does that mean that the code that needs changes is in ot_shipping.php?`

 

This is the result I need to have:

If a only books (tax class 6%) are in the cart the tax on the shipping will be 6%.

If only t-shirts (tax class 25%) are in the cart the tax on the shipping will be 25%.

If both books and t-shirts are in the cart the item with the highest value will set the tax class on the shipping.

 

So I guess I need to compare what?s in the cart and make somekind of if statement.

 

I have no clue how to do this though...can anyone lead me in the right direction.

 

This is some code from my ot_shipping.php

 

		if ($GLOBALS[$module]->tax_class > 0) {
	  $shipping_tax = tep_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
	  $shipping_tax_description = tep_get_tax_description($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);

	  $order->info['tax'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
	  $order->info['tax_groups']["$shipping_tax_description"] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
	  $order->info['total'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);

	  if (DISPLAY_PRICE_WITH_TAX == 'true') $order->info['shipping_cost'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
	}

 

 

Any help would be appreciated.

 

Thanks

/Per

Posted

To code this I guess I have to check the cart to see what items are in there and code something like this:

 

If only books in the cart that are assigned to tax class 6% then add 6% to the shipping

If only t-shirts in the cart that are assigned to tax class 25%, then add 25% to the shipping.

else add to shipping the tax class from the item with highest value.

 

Can anybody point me in the right direction? :blush:

Posted

Does anybody have a solution for this.

 

I have searched the forums but can?t find any solution for this.

 

I know I?m repeating myself but what I?m trying to acheive is:

 

- If an order contains only a items with the tax class 6%. The tax on the shipping should be 6%.

 

- If an order contains only a items with the tax class 25%. The tax on the shipping should be 25%.

 

- If an order contains both items with tax class 6% and 25% the item with the highest order value will be used to set the tax class on the shipping.

 

I would really be happy if somebody could help me with this.

 

/Per

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...