Closed curtismorte closed 3 years ago
I wanted to pose this as a discussion to get your thoughts. There is a likely hood that we'll be able to help facilitate a PR for this.
Before any of that though, having some dialog with you all first would help.
@curtismorte - tax calculation should only happen once there is a shipping address and at least one line item in the cart, and the response is cached until something else changes again (quantity, address, shipping method, etc) so there shouldn't be too many roundtrip requests to the Avatax API already hopefully.
That said for your use case would something like a hidden form attribute that overrides the plugin's tax calculation setting for just the current cart update form help?
Maybe something like:
<input type="hidden" name="avatax_disable_tax_calclution" value="1">
or
<input type="hidden" name="avatax_force_tax_calculation" value="1">
@imagehat that solution would be ideal because it allow us to specify when to submit for calculation.
You have outlined how tax calculation is completed. The e-commerce setup I am working on right now has hundreds of SKUs where purchasing a single SKU is a rare use case and purchasing multiple SKUs that are related is more common. We have a "Catalog" page that groups SKUs together and the user can very quickly select how many quantities of each SKU they need. Think of this as a page that allows you to purchase individual Lego pieces where you need to purchase 10+ pieces for your order to be "meaningful" to you.
We're using Sprig, so each SKU specification causes the cart to be updated which ultimately causes Tax validation to be run frequently for any returning customer (since they have a saved address).
This is not a common use case, but is one that is critical to the way we are operating.
@curtismorte - That makes sense, and I think it will be pretty easy to add the check for those params. I'll take a look and let you know.
Correct me if I'm wrong, but it seems like it may be a good idea to require this parameter to be passed through with a security hash to avoid bypassing taxes.
This a request for an enhancement.
When Tax Calculation is enabled, any cart update causes a tax calculation to run. We have come across a variety of use cases where having to wait for the Tax Adjusters to run because of the communication with the AvaTax API will produce a poor user experience because of the difference between the time a request is made to add something to a cart, and when the request completes.
Instead, we would like to have some programmatic way to manually tell the Tax Calculation to run the Adjuster for the cart. This would be ideal because only the last few pageviews of our sales funnel rely on needing accurate Tax information. We could circumvent the many round trips by only running the Tax Adjuster on the cart when needed.
Is there currently a way to do this? My initial thoughts were to turn Tax Calculation off in the settings and then call some method. However, I didn't see anything in the readme related to manual actions needing to be taken.
As an aside, my suspicion is that Tax Calculation from CP and non-CP requests should likely be treated differently when a use case like above is used. Users on a site would only need the Tax Adjuster to run towards the end of the checkout process. However, operations personnel likely need to have Tax Adjusters run when any updates to a cart trigger a recalculation from within the Control Panel (CP).