Jump to content

How to remove tax from Free Shipping calculation in 1.4.7?


Recommended Posts

I've enabled free shipping on orders over $100 but when calculating this amount the cart is including the taxes. For example if you place an order for $96 with total tax of $4.80 then the shipping becomes free. But I need the cart to exclude the taxes and only base free shipping off the total products less discounts. So in this case with only $96 of product there should still be a shipping charge.

 

I found this thread but it's recommended solution doesn't work on 1.4.7.

http://www.prestashop.com/forums/topic/40513-solved-applying-shipping-cost-based-on-pre-tax-total/

 

I'm hoping somebody else with a North American shop has figured this one out.

Link to comment
Share on other sites

I hope someone will post a code solution. I have this same problem but was not able to find a simple switch to turn off. This is one of the things that amaze me about this cart. So much to love, but then you run into something like this and you realize that the programmers do not run stores. They just don’t use the software because no one would have programmed it this way if ”they” actually used the software.

 

Here is what I did as a work around, but I really do hope someone will post a cleaner solution.

 

Don’t use the free shipping - set it to zero.

 

Create a zone for each tax rate.

 

In My case I needed

 

Canada 5%

HSTBC 7%

HSTNBNLON 8%

HSTNS 10%

 

North America already existed. I use it for USA - No Tax

 

I changed Canada that was part of North America to the new “Canada 5%” zone.

 

I changed each HST province to the HST tax rate and set the tax to charge both taxes

 

Create a carrier for each zone

 

That’s one carrier for the US and 4 for Canada

 

Finally you set up price ranges for each carrier.

 

For example

 

I want to charge,

 

Zero to $50.00 Shipping Charge $12.99

$50.01 to $75.00 Shipping Charge $15.99

$75.01 to $99.99 Shipping Charge $18.99

Order Over $100.00 - FREE Shipping

 

So for all provinces that are 5%

 

I need to allow for the tax and set the range price related to the tax.

 

$0.00 - $52.515 - Shipping $12.99

$52.51 - $78.765 - Shipping $15.99

$78.76 - $105.015 - Shipping $18.99

105.01 - 10000.00 - Free

 

And so on for each tax rate for each zone. Notice that I use 3 digits to end each price range “$0.00 - $52.515” this is because there is a nasty bug … if you do not use three digits then it is possible that someone will get free shipping if their purchase comes to exactly $52.51. PrestaShop will give free shipping if the purchase lands between 2 shipping ranges if you don’t use 3 digits.

Link to comment
Share on other sites

Bdalton, I saw your earlier post also but no one answered it. I also really hope we can find a simpler solution. I haven't even begun to tackle countries and zones. Eventually my free shipping should only be for only US customers.

 

I think it's got something to do with this part of the code in cart.php and as always prestashop is assuming the total product amount should include taxes:

 

// Free fees

$free_fees_price = 0;

if (isset($configuration['PS_SHIPPING_FREE_PRICE']))

$free_fees_price = Tools::convertPrice((float)($configuration['PS_SHIPPING_FREE_PRICE']), Currency::getCurrencyInstance((int)($this->id_currency)));

$orderTotalwithDiscounts = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING);

if ($orderTotalwithDiscounts >= (float)($free_fees_price) AND (float)($free_fees_price) > 0)

return $shipping_cost;

if (isset($configuration['PS_SHIPPING_FREE_WEIGHT']) AND $this->getTotalWeight() >= (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) AND (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) > 0)

return $shipping_cost; // Free fees

$free_fees_price = 0;

if (isset($configuration['PS_SHIPPING_FREE_PRICE']))

$free_fees_price = Tools::convertPrice((float)($configuration['PS_SHIPPING_FREE_PRICE']), Currency::getCurrencyInstance((int)($this->id_currency)));

$orderTotalwithDiscounts = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING);

if ($orderTotalwithDiscounts >= (float)($free_fees_price) AND (float)($free_fees_price) > 0)

return $shipping_cost;

if (isset($configuration['PS_SHIPPING_FREE_WEIGHT']) AND $this->getTotalWeight() >= (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) AND (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) > 0)

return $shipping_cost;

Link to comment
Share on other sites

On a whim I decided to change the following line in cart.php

 

line 1122 I changed from true:

 

$orderTotalwithDiscounts = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING);

 

to false:

 

$orderTotalwithDiscounts = $this->getOrderTotal(false, Cart::BOTH_WITHOUT_SHIPPING);

 

 

So far it seems to be working but I'll keep testing. Maybe someone who knows more about the code or Prestashop can explain why?

 

You also need to change line 1351 to:

 

$total_free_ship = $free_ship - ($this->getOrderTotal(true, Cart::ONLY_PRODUCTS) + $this->getOrderTotal(true, Cart::ONLY_DISCOUNTS) - $total_tax);

 

So the "Remaining amount to be added to your cart in order to obtain free shipping:" also excludes tax.

Link to comment
Share on other sites

×
×
  • Create New...