Page 1 of 2

Free Shipping Mis-calculation Bug.

Posted: Wed Mar 30, 2011 7:11 am
by fab26x
Hi Everyone,

I'm having some issues with using the free shipping. Here is the bug:

We are giving FREE SHIPPING for orders above $90.00
We have a coupon for $30.00 discount for orders over $100.00
___________
SCENARIO

A. Client buys $105.00 worth items. ( which means FREE SHIPPING ) no problem here yet.
B. Client uses Discount Coupon for $30.00 ( Order total = $105 ).
New order total after coupon discount = $75.00
There should be NO FREE SHIPPING for orders less than $90.00

System is not looking new total and still honoring the FREE SHIPPING, even thought the new order total after "Coupon Discount" is less than what FREE SHIPPING is set at which is $90.00

If I look at index.php?route=checkout/shipping
Cart shows:
Item 1 Shirt $105.00
Coupon (-30.00): -R$30,00
Sub-total: R$105,00
Total: R$75,00

For Shipping, it will show FREE SHIPPING, though TOTAL is less than $90.00. Looks like Free Shipping is looking into Sub-total and not Total.

Can you guys help ? I'm on v.1.4.8b

Re: Free Shipping Mis-calculation Bug.

Posted: Wed Mar 30, 2011 7:49 am
by Qphoria
Subtotal should always be sorted first
Total should always be last.
Try setting the shipping after the coupon total. That should work

So you'll have:

Subtotal: 105.00
Coupon: -25.00
Shipping: 10.00
Total: 90.00

Re: Free Shipping Mis-calculation Bug.

Posted: Wed Mar 30, 2011 8:51 pm
by fab26x
How do I set shipping after the coupon ? Because I've done refresh the cart, and page.. while total shows the total amount correct, it still giving FREE SHIPPING while the total is less than what is set for FREE SHIPPING.

Thanks for the help

Re: Free Shipping Mis-calculation Bug.

Posted: Wed Mar 30, 2011 9:20 pm
by Johnathan
The original poster is right -- coupons aren't taken into account. The Free Shipping model file uses:

Code: Select all

$this->cart->getSubTotal() 
to compare the totals, which just adds all the product totals together. There needs to be some type of "check coupon" routine within getSubTotal() in order for it to calculate properly.

Re: Free Shipping Mis-calculation Bug.

Posted: Wed Mar 30, 2011 10:48 pm
by fab26x
Johnathan,
I've found that code within model/shipping/free.php
$this->cart->getSubTotal() and you are correct. There should be some kind of code which will take in consideration Total and not SubTotal . I've tried
$this->cart->getTotal() When I use 'echo' I get the same result for getSubTotal() and getTotal(). Which is strange since while looking at the shopping cart they have different values.

Does anyone know how to get the result from Total and not SubTotal ?

Re: Free Shipping Mis-calculation Bug.

Posted: Wed Mar 30, 2011 10:51 pm
by fab26x
Within model/shipping/free.php: "if ($this->cart->getSubTotal() < $this->config->get('free_total'))"

echo $this->cart->getSubTotal();
and
echo $this->cart->getTotal();

Results are the same.

I would like to be able to read TOTAL that shows the correct value, which is in the shopping cart.

Any ideas ?

Re: Free Shipping Mis-calculation Bug.

Posted: Wed Mar 30, 2011 11:24 pm
by Qphoria
fab26x wrote:How do I set shipping after the coupon ? Because I've done refresh the cart, and page.. while total shows the total amount correct, it still giving FREE SHIPPING while the total is less than what is set for FREE SHIPPING.

Thanks for the help
You set the sort order in the Extensions->Order Total area.

Re: Free Shipping Mis-calculation Bug.

Posted: Wed Mar 30, 2011 11:36 pm
by Qphoria
The real issue here is bigger than just subtotal.. the fact is you choose shipping BEFORE entering a coupon so there is an order-of-operation issue. This will likely being easier to address in 1.5.0 when the new one page checkout is easier to sync better. Then we can be sure that coupon changes are before the shipping.

Re: Free Shipping Mis-calculation Bug.

Posted: Thu Mar 31, 2011 12:34 am
by fab26x
Yes, changing the order of items in "Extensions->Order Total area." does not fix the issue. Which is FREE SHIPPING calculated based on subTotal and not final Total. Also while playing around with the items order I noticed some of the calculations get messed up.

As far changing the order of the items it did not fix the problem I'm having. My purchase amount is less than what's set for FREE SHIPPING ( subTotal - cupom = new total ) and the system is giving FREE SHIPPING. The way I look at it, is FREE SHIPPING should calculate using TOTAL and not SubTotal.

Any ideas ?

Re: Free Shipping Mis-calculation Bug.

Posted: Thu Mar 31, 2011 2:34 am
by Qphoria
fab26x wrote:Also while playing around with the items order I noticed some of the calculations get messed up.
As long as subtotal is first and total is last the rest should work fine.. except for coupon. As I said, it is a "cart before the horse" issue at this point and not much really can be done about it easily without changing the order of checkout which is planned for 1.5.0

Re: Free Shipping Mis-calculation Bug.

Posted: Thu Mar 31, 2011 10:03 am
by mberlant
I would not want to test for the free shipping threshold from the "Total", either, because I don't want taxes or handling charges to push the cart value over the limit for free shipping.

Re: Free Shipping Mis-calculation Bug.

Posted: Thu Sep 08, 2011 9:25 pm
by hopec
Hi,

I am experiencing the same issue.

For example, I have free shipping for orders over $50. A customer's order total is $55. They enter a coupon for $10 off. The total is now $45 with free shipping. The shipping module does not recalculate to remove the free shipping. I read that this issue would be addressed in 1.5, which is the version that I'm using, and I was just wondering what the status is.

Thank you for all your help!

1.5.1

Re: Free Shipping Mis-calculation Bug.

Posted: Thu Dec 01, 2011 7:44 am
by Seuldieu
Any developments on this? I'm using 1.4.9.3 and the "order of operations" is definitely buggered.

I was thinking of attempting an overhaul, where coupons and customer information are entered first... and then on the order confirm page, you select your shipping options—I'm not that confident of an Opencart developer though, haha... gonna have to do some trial runs.

Re: Free Shipping Mis-calculation Bug.

Posted: Thu Dec 01, 2011 2:36 pm
by Qphoria
Seuldieu wrote:Any developments on this? I'm using 1.4.9.3 and the "order of operations" is definitely buggered.

I was thinking of attempting an overhaul, where coupons and customer information are entered first... and then on the order confirm page, you select your shipping options—I'm not that confident of an Opencart developer though, haha... gonna have to do some trial runs.
This has nothing to do with this topic.

Re: Free Shipping Mis-calculation Bug.

Posted: Wed Dec 21, 2011 1:32 am
by dizarter
Now that we have 1.5.1.3 is this any easier to address? Because this can be seen as a severe bug.

Re: Free Shipping Mis-calculation Bug.

Posted: Wed Dec 21, 2011 2:02 am
by Qphoria
dizarter wrote:Now that we have 1.5.1.3 is this any easier to address? Because this can be seen as a severe bug.
This has already been addressed when we moved the coupon to the cart page before the shipping step. There should be no issue if you set the coupon order total before the shipping order total.

Re: Free Shipping Mis-calculation Bug.

Posted: Wed Dec 21, 2011 2:19 am
by dizarter
Hi Q, and thanks for such a prompt answer.

They say a picture says more then a thousand words, so I am attaching a screencap of "checkout/cart" page.

Free shipping is set to be available if Sub-total is at least $51.

You can see that everything is set as it should be, yet free shipping still appears as an option, even though sub-total is less then $51 after applying a coupon.
free_shipping_coupon_bug.jpg

free_shipping_coupon_bug.jpg (93.72 KiB) Viewed 5866 times


Re: Free Shipping Mis-calculation Bug.

Posted: Wed Dec 21, 2011 2:57 am
by dizarter
The problem seems to be that module has absolutely no idea if coupons are applied or not (not to mention tax and other stuff),
thus $this->cart->getSubTotal() returns the same value as $this->cart->getTotal().

Re: Free Shipping Mis-calculation Bug.

Posted: Wed Dec 21, 2011 3:45 am
by dizarter
Solved!

Re: Free Shipping Mis-calculation Bug.

Posted: Fri Jan 06, 2012 11:21 pm
by nickt15
Can you tell me how you solved this, I am having the same problem, I did everything the Q sd as far as the sort order, etc.. & my free shipping coupon will still not work, the UPS charges still show up at the end of check out, help someone !!