Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowing Programmatic Tax Calculation #40

Closed
curtismorte opened this issue Jul 19, 2021 · 5 comments · Fixed by #41
Closed

Allowing Programmatic Tax Calculation #40

curtismorte opened this issue Jul 19, 2021 · 5 comments · Fixed by #41
Labels
enhancement New feature or request

Comments

@curtismorte
Copy link

curtismorte commented Jul 19, 2021

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).

@curtismorte
Copy link
Author

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.

@imagehat
Copy link
Collaborator

@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 imagehat added the enhancement New feature or request label Jul 20, 2021
@curtismorte
Copy link
Author

curtismorte commented Jul 22, 2021

@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.

@imagehat
Copy link
Collaborator

@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.

@Mosnar
Copy link

Mosnar commented Jul 28, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants