Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Discount Coupon Codes Shipping Tax


jonkersdw

Recommended Posts

Hello all,

 

The problem I am having is that I created a coupon code that is for free shipping and since the shipping amount is taxable it adds the tax amount on the shipping to the total.

Is there some code that I can include that will fix the problem.

 

EX.

 

Discount Coupon CindyFreeShip applied: -$7.95

Sub-Total: $29.95

Table Rate (Best Way): $7.95

GST 5% + PST 8%: $4.93

Total: $34.88

 

The Total should be $33.84, but its not because it has the shipping's taxes added onto it which total $1.04.

Since the tax rate will be different depending on where the user is, it there a way to see if what the shipping tax amount is and remove it from the total as well?

Link to comment
Share on other sites

Solved.

 

 

Here is how I did it.

 

In the ot_shipping.php file

 

Find approx: line 55

 

$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);

 

 

Replace with:

 

// Shipping Discount
	if( is_object( $order->coupon ) ) {
		if($order->coupon->coupon['coupons_discount_type']=="shipping"){
			$order->info['tax'] += tep_calculate_tax(($order->info['shipping_cost'] - ($order->info['shipping_cost'] * $order->coupon->coupon['coupons_discount_amount'])), $shipping_tax);
			$order->info['tax_groups']["$shipping_tax_description"] += tep_calculate_tax(($order->info['shipping_cost'] - ($order->info['shipping_cost'] * $order->coupon->coupon['coupons_discount_amount'])), $shipping_tax);
			$order->info['total'] += tep_calculate_tax(($order->info['shipping_cost'] - ($order->info['shipping_cost'] * $order->coupon->coupon['coupons_discount_amount'])), $shipping_tax);
		}else{
			$regular_shipping_taxes = "Yes";
		}
	}else{
		$regular_shipping_taxes = "Yes";
	}
	// End of Shipping Discount

	if($regular_shipping_taxes=="Yes"){
	  $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);
	}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...