Closed sparkalow closed 3 years ago
@sparkalow - You can disable address validation in the plugin settings by turning off "Enable Address Validation".
Most stores using this plugin either don't use Avalara's address validation service, use it via the json endpoint with javascript (which works even if the address validation setting is off), or have some other address validation service in place.
Avalara is very strict and will not return any sales tax for a bad address. But I agree the exception is pretty heavy-handed. What would make more sense for you? Something like adding the errors to the Cart errors instead?
@imagehat I knew it was something I overlooked (typical).
I was going to suggest, capturing and logging the exception and leaving it up to plugin users to deal with zero tax calculations in their own way.
For my case, it makes sense to allow an order to be made with no taxes and then manually sort it out later. I don't know offhand if a Cart error would still allow an order to be completed.
When updating an order/cart with a bad address, an uncaught exception is thrown. This results in an error causing Craft to render it's environment specific error page. I noticed this after having a local test user with a crappy address, then installing/configuring the plugin and logging in with that user. It also happens when setting a bad address normally during checkout (tested with default commerce templates).
This seems like a mature plugin and I find it hard to believe that a bad address could have this effect. I'm hoping there is a documentation I missed or I'm doing something dumb to cause this.
Details
Bad cart addresses (with wrong U.S. zip/state) results in this api response(taken from Avatax log):
Causes uncaught exception here
/src/services/SalesTaxService.php at line 714
effectively killing the page.System report: PHP version 7.4.15 Craft Pro 3.6.4.1 Craft Commerce 3.2.14.1 Avatax | 2.1.3