On Ubercart checkout, a conditional action that is tied to the billing address does not get triggered if only the delivery address is filled in and then "My billing information is the same as my delivery information" is checked.
For example, I have an action configured to charge GST if the billing country is Canada AND the billing province is British Columbia. This works only if country and province are selected under "Billing information". However, if only "Delivery information" is filled in and then "My billing information is the same as my delivery information" is checked, the tax is not added to the order total preview--even though it should be.
Using Drupal 6.10 + Ubercart 2.0Beta5 on Apache 2.2.11 + PHP 5.2.8 (I believe)
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | copied_address_onchange.patch | 812 bytes | Island Usurper |
| #5 | tax_billing_and_delivery.patch | 413 bytes | Island Usurper |
Comments
Comment #1
rszrama commentedComment #2
Island Usurper commentedThere's a check in the tax calculations that decides not to update the line items when none of the other line items have changed. When you set the billing information to be the same, shipping quotes are recalculated, but most of the time they would be the same amount. Taxes are then not updated, even though they probably should be.
Comment #3
quevo commentedThanks for looking into this. Taxes _SHOULD ALWAYS BE_ updated. If a merchant is legally supposed to charge tax, how else is that supposed to get added to the buyer's bill? What possible reason is there for not updating the taxes?
You mentioned there's a check not to update the taxes, would you be able to point me to that bit of code so I can disable it and allow taxes to be properly calculated? To me this is a pretty major issue.
Thanks
Comment #4
Island Usurper commentedNo. The one reason taxes should not be updated is when doing so doesn't change anything, but causes taxes to be updated again. The check is there to prevent an infinite loops. I'll rant about paying taxes on taxes later.
That said, it's a bug that taxes aren't being updated when the copy address box is checked. I don't know exactly where it is, but I imagine it's something to do with the values from the billing address fields being read before they are populated with the delivery address.
Comment #5
Island Usurper commentedJust to clarify, this is just a cosmetic issue. The taxes are being correctly calculated, but they just aren't being displayed in this one instance. If a customer continues on to the review order screen, they should see the taxes there.
I was right the first time in that the line items preview isn't being refreshed because the shipping quotes value isn't being changed when the address is copied. The attached patch gets around this by forcing taxes to be recalculated, which will be rendered if they are different from before.
Comment #6
quevo commentedThank you, Island Usurper.
Will that patch be making 2.0 beta 6? Is there an ETA for Beta 6 release?
If I was going to manually apply that patch, what line should I place the modified lines in? Sorry, I'm a n00b.
Comment #7
Island Usurper commentedThe line with the @@ shows which line the next few start on. Since it's the first change in the patch, it's the same for both the old and new versions: 34, with the next 6 lines shown for the old version and 7 for the new. The line starting with + was added in the new version. Any lines that were removed from the old version would be marked with -.
I'm going to try my best to push a release candidate out on Saturday. There's really only one issue that's currently preventing that from happening, and it involves some significant API changes. Those will have to be implemented, tested, and (dare I say it?) documented by then for it to happen.
Comment #8
quevo commentedThank you very much, Island Usurper. I added that line and now it works as it should.
Looking forward to the next release.
Take care
Comment #9
Island Usurper commentedExcellent. Committed the change.
Comment #10
quevo commentedCrap. Seems I spoke too soon. One problem remains:
If after "My billing information is the same as my delivery information" has been checked, address information is entered or changed, tax information is not updated.
Is it possible to have this fixed in time?
Thanks
Comment #11
quevo commentedReopening.
Comment #12
Island Usurper commentedIt looks like changing the delivery address doesn't trigger the change event in the billing address fields. That would be ok, except that tax calculations are triggered before the values are copied, so they're still the same value as before.
Part of me wants to do something clever and use the copy address function to make sure the onChange events are only triggered by the fields that are hidden, so they only happen once. But that's pretty complicated, and I probably wouldn't get it quite right the first time.
So, in the interest of laziness efficiency we'll just calculate the taxes again for the billing address whenever the delivery address is changed and its value is copied over.
Comment #13
quevo commentedOk. Applying both patches does the trick. This time I also made sure to test all possible scenarios I could think of.
Works well. Thanks again.
Comment #14
Island Usurper commentedThanks for being so quick with the reviews.
Committed to repository.
Comment #15
Island Usurper commented