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

Additional hooks/functions for tax calculation outside of WooCommerce #259

Open
jordanmaurice opened this issue Aug 7, 2024 · 1 comment

Comments

@jordanmaurice
Copy link

We are attempting to set up a Gravity Form that people can receive a quote for our products through, rather than navigating through the site. We want to include a tax amount calculated by TaxJar for the total, but we're not sure how to use the API outside of the plugin.

What I essentially want to do is have this kind of function:

function get_tax_amount($to_country, $to_zip, $to_state, $to_street, $amount, $shipping){
  $tax_amount = some_taxjar_function($to_country, $to_zip, $to_state, $to_street, $amount, $shipping); 
  return $tax_amount;
}

I'm aware there is the PHP library, but I'm not familiar with how to add that library to a WordPress website as we don't run composer or anything on our end.

Is there some kind of function that I can already access that I'm not aware of? I could not find any hooks/actions/functions documentation for the plugin.

@ahumulescu
Copy link
Collaborator

ahumulescu commented Aug 12, 2024

Hello,

Thank you for reaching out to us!

The following method is responsible for tax calculation: Tax_Client::get_taxes( $tax_request_body )

In theory, you should be able to manually use it in Gravity Forms as well. You would need to instantiate a $tax_request_body object using your data then call the get_taxes method with the created object.

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

No branches or pull requests

2 participants