Giter Site home page Giter Site logo

taxjar / taxjar-woocommerce-plugin Goto Github PK

View Code? Open in Web Editor NEW
28.0 17.0 29.0 2.13 MB

WooCommerce Sales Tax Plugin by TaxJar

Home Page: http://www.taxjar.com/woocommerce-sales-tax-plugin/

License: GNU General Public License v2.0

PHP 97.62% CSS 0.77% JavaScript 1.09% Shell 0.52%
sales-tax tax-rate tax taxjar woocommerce ecommerce

taxjar-woocommerce-plugin's People

Contributors

dallen-stripe avatar dallendalton avatar dubdromic avatar fastdivision avatar forgueam avatar iamdharmesh avatar jeffstieler avatar marcinbot avatar masolano-stripe avatar ryanreeves-taxjar avatar sethobey avatar smolentzov-stripe avatar tonkapark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

taxjar-woocommerce-plugin's Issues

Conflict with WooCommerce Smart Coupons

I am using WooCommerce Smart Coupons to provide store credit to customers. When TaxJar is activated and a customer uses a store credit, the credit balance will be set to $0.00 after checkout even if there should be a remaining balance.

I have switched to a default 2017 theme and disabled all plugins except WooCommerce, TaxJar, and Smart Coupons. The error persists. If I deactivate TaxJar and place an order with a store credit, the credit balance will be correct.

You can test this by adding this product to an empty cart, then use a store credit with a value higher than the cart total. The cart, checkout, and confirmation totals all look correct. Aftre checkout, the store credit should have a balance remaining, but if you try repeating the order and using the same store credit, you will see that the credit has $0.00 balance. In the backend, the credit also shows a $0.00 balance.

Our site relies heavily on the use of store credit, so we would like to have this resolved quickly. Can you take a look at this issue?

Temporary ignore Exemptions

Our company is primarily B2B, and many of our clients are resellers. However sometimes clients will order products as NFR (Not For Resale) in which case we need to charge taxes even if we have them marked as exempt for the state they are shipping too.

How can we temporarily ignore an exemption for a user during checkout and charge tax for a single order?

TaxJar creates a WP User?

So going thru the code a bit on the plugin, I'm a bit confused? Why does TaxJar create a WordPress User for the API?

Error when activating TaxJar Plugin without WooCommerce

There was one issue - when I activated the TaxJar plugin with out first activating WooCommerce I got the following error:

Fatal error: Call to undefined function wc_delete_product_transients() in /Applications/MAMP/htdocs/taxjar/test/wp-content/plugins/taxjar-simplified-taxes-for-woocommerce/taxjar-woocommerce.php on line 66

Suggested code snippet that might be able to be inserted at line 62 of taxjar-woocommerce.php in the plugin_registration_hook that will show an error message explaining that WooCommerce needs to be activated first:

    if (! class_exists( 'Woocommerce' ) ) {
      $message = 'Please activate WooCommerce before activating TaxJar';
      if(isset($_GET['action']) && $_GET['action'] == 'error_scrape') {
        echo '<strong>' . $message . '</strong>';
        exit;
      } else {
        trigger_error($message, $errno);
      }
    }

Subscription renewal doubles line item tax

Steps to reproduce

  1. Update the plugins to the latest versions. It also doesn't work with older versions.

Screenshot 2021-02-11 at 17 57 17

  1. Create a subscription. Use a delivery address that pulls tax rate via the TaxJar API. We are using a tax class on the product but I don't think it matters.
  2. Process renewal

Screenshot 2021-02-11 at 18 00 45

  1. Line item gets double taxes applied.

Screenshot 2021-02-11 at 18 01 30

  1. If you press Recalculate, it gets recalculated properly.

I traced down the issue to this loop. So the loop will add a tax line item for each existing line item. Even if the tax item already exists.

TaxJar removes international tax rates on plugin activation

We are using TaxJar for domestic (US) tax rates, and filing our Australia (AU) and United Kingdom (GB) tax rates separately.

One issue we encountered is that this plugin appears to have truncated the entire tax rates table on activation (https://github.com/taxjar/taxjar-woocommerce-plugin/blob/master/taxjar-woocommerce.php#L269) which wiped out our international tax rates.

We didn't realize the rates were missing for a couple days, which led to some loss of revenue from AU and GB and required manual fixes for the orders.

Ideally, I think there should be a notice before deleting site data- especially with non-domestic tax rates.

Subscription sign-up fees are not being accounted for, making taxes incorrect

This issue was first created in the WCS repo: Automattic/woocommerce-services#1250

I've tested with WCS disabled and only TaxJar in play - the bug still occurs. It seems that somehow with TaxJar calculations enabled, the sign up fee is completely dropped from the line items. Not only is the tax incorrect, the sign up fee won't be collected.

Quoting @NickGreen from Automattic/woocommerce-services#1250:

Internal Prospress ticket #2710

Problem

The Signup Fee is not being accounted for in the total making taxes incorrect. This is being reported on several tickets.

Duplication

WooCommerce Services: by Automattic - 1.9.0
WooCommerce Subscriptions: by Prospress Inc. - 2.2.15
WooCommerce: by Automattic - 3.2.5

Set up subscription product for a 16.99/month with 1 month free and a $600 dollar signup fee.

Cart totals

SUBTOTAL $16.99
TAX $1.32
TOTAL $18.31
RECURRING TOTALS
SUBTOTAL $16.99 / month
TAX $1.32 / month
RECURRING TOTAL $18.31 / month
First renewal: December 22, 2017

Confirmed that each product is marked as taxable with the standard rate.

Backend tax calculations cause fatal error with deleted items

Heya! When trying to update an order with a product that has been deleted since the order was first placed, a user will encounter an error and won't be able to proceed.

Steps to Repro

  1. Create an order with a product you can delete later
  2. Delete the product permanently
  3. Go to the Edit Order page and try to click the 'update' button. See fatal error.

This happens because wc_get_product( $id ) (ref) returns false in

$product = wc_get_product( $id );

To solve this, it's possible to use $unit_price = $item->get_subtotal(); for getting the price and 'taxable' !== $item->get_tax_status() for getting the tax status.

Order total on cart page doesn't include shipping taxes

When using a flat rate shipping option and putting items in a cart on WooCommerce, after calculating shipping the taxes are calculated and properly displayed as tax on the item and shipping but the order total is only the items + shipping + item tax. The shipping tax is not included for some reason.

I think the solution is to add this line after 528 in class-wc-taxjar-integration.php

$wc_cart_object->shipping_tax_total = $this->shipping_collectable;

Recalculation Button causes Fatal Error

We're working on a custom ecomm site.

PHP Fatal error: Uncaught Error: Call to a member function get_tax_rate() on bool in /Users/danieldayton/Local Sites/pteus-com/app/public/wp-content/plugins/taxjar-simplified-taxes-for-woocommerce/includes/TaxCalculation/class-order-tax-applicator.php:151
Stack trace:
#0 /Users/danieldayton/Local Sites/pteus-com/app/public/wp-content/plugins/taxjar-simplified-taxes-for-woocommerce/includes/TaxCalculation/class-order-tax-applicator.php(111): TaxJar\Order_Tax_Applicator->get_product_line_item_tax_rate(458, Object(WC_Order_Item_Product))
#1 /Users/danieldayton/Local Sites/pteus-com/app/public/wp-content/plugins/taxjar-simplified-taxes-for-woocommerce/includes/TaxCalculation/class-order-tax-applicator.php(93): TaxJar\Order_Tax_Applicator->create_product_tax_rate(458, Object(WC_Order_Item_Product))
#2 /Users/danieldayton/Local Sites/pteus-com/app/public/wp-content/plugins/taxjar-simplified-taxes-for-woocommerce/includes/TaxCalculation/class-order-tax-applicator.php(82): TaxJar\Order_Tax_Applicator->create_rate_and_apply_to_product in /Users/danieldayton/Local Sites/pteus-com/app/public/wp-content/plugins/taxjar-simplified-taxes-for-woocommerce/includes/TaxCalculation/class-order-tax-applicator.php on line 151

We're getting this error whenever the recalculation button is clicked on the order admin screen.

We've dug into the plugin some. It seems the $line_items array is empty. We've tried deactivating all other plugins except payment gateway (Elavon), WooCommerce and Taxjar and we're still getting the same error.

Any recommendations on causes/debugging?

WC - 5.5.1
Taxjar - 3.2.10
WP - 5.7.2

Zero Tax rate set to a non-zero rate

From Automattic/woocommerce-services#1256 (cc: @slash1andy)

This came up with a VAT Disability Exemption chat. Turned out that the reason that the VAT wasn't being taken off is that it applies the Zero-rate tax rate to the order, and the Zero-rate was actually 20% VAT, like the regular rate. I had to turn off the automated taxes because it wouldn't let me manually change the rate. I could change the other settings on the rate, just not the actual rate (or it would revert).

All prices inclusive of tax, using automated taxes.

Shop location:
Standard Rates:
Zero Rates:

Taxes not calculated properly for British Columbia, Manitoba, and Saskatchewan

From Automattic/woocommerce-services#1253 (cc: @mikeyarce)

Canada Post only requires GST when shipping things from British Columbia, Manitoba, and Saskatchewan.

From Canada Post:
https://www.canadapost.ca/web/en/kb/details.page?article=collecting_sales_tax&cattype=kb&cat=generalinquiries&subcat=generalinformation

Here's how the taxes are split up for these provinces:
screen shot 2017-12-01 at 14 37 14

What WooCommerce Services does is combines the GST and PST into one tax:
screen shot 2017-12-01 at 14 39 26
Which means you're then unable to separate them and only charge one of them on Shipping.

What the TaxJar API should be doing is adding 2 tax rates to each Province, with the correct GST and PST for each, and then only checking off the "Shipping" box for the GST section.

The workaround, for now, is to ask users to disable Automatic Taxes and have them enter in their taxes for Canada manually.

Fee lines prevent TaxJar sync

We noticed some order of our orders are not syncing into TaxJar even though the order had taxes charged.

The scheduled action failed with this notice:

Invalid request sent to TaxJar. Details: Order amount must be equal to the sum of line items and shipping

It appears the pattern with all these items is that they have fee lines.

Here's an example order with the results from the woocommerce_order_items table:

order_item_id order_item_name order_item_type order_id
8963740 Yum Yum Box line_item 6360409
8963741 Expedite First Box fee 6360409
8963742 Referral Discount fee 6360409
8963743 Free shipping 6360409
8963744 US-OK-OK TAX-1 tax 6360409

The referral fee specifically looks like this:

meta_id order_item_id meta_key meta_value
72843667 8963742 _fee_amount -5
72843668 8963742 _tax_class 0
72843669 8963742 _tax_status taxable
72843670 8963742 _line_total -5
72843671 8963742 _line_tax -0.46
72843672 8963742 _line_tax_data a:1:{s:5:"total";a:1:{i:6794;s:9:"-0.458036";}}

I am wondering what the best solution for this is. Does this integration not work with fee lines? Or are we doing something specific that is breaking the integration?

Better handle when user does not have PHP 5.3+

TaxJar now requires PHP 5.3+ installed, and WordPress/WooCommerce recommend even newer PHP as well under the "WooCommerce->System Status" report.

Can we fail to initialize the plugin to avoid breaking their checkout when the wrong PHP is installed?

Make this plugin work in the EU

Hi!

Your plugin for Woocommerce does the tax calculations wrong if you are a EU based shop selling to other EU countries.

All the taxes it calculates is 25% (Swedish tax, I'm based in Sweden) even if the customer is based in let's say Germany (where the tax is 19%)

When looking in the log it seems like it's basing the tax on the shop origin ("tax_source":"origin") rather than the buyers origin which is wrong.

Please correct, or advice. Been trying to get automated taxes in Woocommerce to work for like 1 week now.

I'm based in EU and only interested in rates for member EU states to apply to EU law,

Thanks!

Answer from your support:

Thank you for reaching out, I'm happy to help with this!

What's happening is our API calculates the VAT rate of the origin rather than the destination because that's how needs to be calculated for people selling under a certain threshold. Most of our customers are small businesses and won't cross the threshold, so that's why we have it this way. We have more details on that in our blog post here.

Out of the box, we do not yet have a way to flip this in WooCommerce. I apologize for this inconvenience.

If you'd like, and if you have developer resources - because our WooCommerce plugin is open source, you can fix this by swapping the "to" and "from" parameters in the calls to our API. That way you will be charging destination rates instead of origin rates. This would be in this method:
https://github.com/taxjar/taxjar-woocommerce-plugin/blob/2.0.1/includes/class-wc-taxjar-integration.php#L275

I hope that helps, please let me know if you have further questions!

Filter for Sync Users

Hello,

I first want to say thank you for the big update, very good stuff. So we are running some code that updates the tax_exemption_type and tax_exempt_regions for many users at once.

What is the best way to trigger the sync with TaxJar once we update those fields? Is there a filter we can use or a function we need to run?

I would also like to ask, is there a filter to override the name/address fields that are syncing?

Automatic tax class setup from /v2/categories?

I was hoping to get to this during a "hack week", but didn't end up having time - so I'm sharing the idea with y'all. ๐Ÿ™‚

TaxJar supports certain product categories and tax exemptions. Their documentation for setup is here: https://support.taxjar.com/article/309-overriding-tax-rates-and-exempting-products-in-woocommerce

Using the /v2/categories endpoint, we can retrieve a list of supported tax categories and create tax classes based on them as a convenience for our users.

From: Automattic/woocommerce-services#1306

Taxes are being calculated for Zero rate rates

I am running into an issue where tax rates are being calculated for the 'Zero rate rates'
I would assume that Zero rates, were just that, 0% ?

I have certain customers set to have the Zero rate rates, and would like to be able to not have these automatically calculated, or maybe setup an additional tax class that isn't automatically calculated?

TaxJar calculation causes multiple/redundant shipping calculations to occur

Enabling TaxJar calculations (and subsequently WCS taxes) causes multiple shipping calculations to occur when updating cart contents or using the in-cart shipping calculator.

This results in multiple requests to shipping APIs (when using extensions that do so) as well as extra/unnecessary requests to the TaxJar API itself.

This can be seen by using a shipping method extension with a debug mode:

screen shot 2018-03-29 at 12 59 45-fullpage

Or by inspecting the TaxJar log:

03-29-2018 @ 19:04:50 - :::: TaxJar Plugin requested ::::
03-29-2018 @ 19:04:50 - :::: TaxJar API called ::::
03-29-2018 @ 19:04:50 - Received: {"tax":{"order_total_amount":7.65,"shipping":6.65,"taxable_amount":1.0,"amount_to_collect":0.08,"rate":0.0845,"has_nexus":true,"freight_taxable":false,"tax_source":"origin","breakdown":{"taxable_amount":1.0,"tax_collectable":0.08,"combined_tax_rate":0.0845,"state_taxable_amount":1.0,"state_tax_rate":0.047,"state_tax_collectable":0.05,"county_taxable_amount":1.0,"county_tax_rate":0.0185,"county_tax_collectable":0.02,"city_taxable_amount":1.0,"city_tax_rate":0.019,"city_tax_collectable":0.02,"special_district_taxable_amount":0.0,"special_tax_rate":0.0,"special_district_tax_collectable":0.0,"line_items":[{"id":"208-091d584fced301b442654dd8c23b3fc9","taxable_amount":1.0,"tax_collectable":0.08,"combined_tax_rate":0.0845,"state_taxable_amount":1.0,"state_sales_tax_rate":0.047,"state_amount":0.05,"county_taxable_amount":1.0,"county_tax_rate":0.0185,"county_amount":0.02,"city_taxable_amount":1.0,"city_tax_rate":0.019,"city_amount":0.02,"special_district_taxable_amount":0.0,"special_tax_rate":0.0,"special_district_amount":0.0}]}}}
03-29-2018 @ 19:04:50 - :: Tax Rate Found ::
03-29-2018 @ 19:04:50 - Array
(
    [3] => Array
        (
            [rate] => 8.4500
            [label] => UT Tax
            [shipping] => no
            [compound] => no
        )

)

03-29-2018 @ 19:04:50 - :: Updating Tax Rate To ::
03-29-2018 @ 19:04:50 - Array
(
    [tax_rate_country] => US
    [tax_rate_state] => UT
    [tax_rate_name] => UT Tax
    [tax_rate_priority] => 1
    [tax_rate_compound] => 
    [tax_rate_shipping] => 0
    [tax_rate] => 8.45
    [tax_rate_class] => 
)

03-29-2018 @ 19:04:50 - Tax Rate ID Set for 3
03-29-2018 @ 19:04:50 - :: Tax Rate Found ::
03-29-2018 @ 19:04:50 - Array
(
    [3] => Array
        (
            [rate] => 8.4500
            [label] => UT Tax
            [shipping] => no
            [compound] => no
        )

)

03-29-2018 @ 19:04:50 - :: Updating Tax Rate To ::
03-29-2018 @ 19:04:50 - Array
(
    [tax_rate_country] => US
    [tax_rate_state] => UT
    [tax_rate_name] => UT Tax
    [tax_rate_priority] => 1
    [tax_rate_compound] => 
    [tax_rate_shipping] => 0
    [tax_rate] => 8.45
    [tax_rate_class] => 
)

03-29-2018 @ 19:04:50 - Tax Rate ID Set for 3
03-29-2018 @ 19:04:52 - :::: TaxJar Plugin requested ::::
03-29-2018 @ 19:04:52 - :::: TaxJar API called ::::
03-29-2018 @ 19:04:52 - Requesting: https://api.taxjar.com/v2/taxes - {"from_country":"US","from_state":"UT","from_city":"Park City","from_zip":"84068","to_country":"US","to_state":"UT","to_city":"Salt Lake City","to_zip":"84102","shipping":"6.65","line_items":[{"id":"208-091d584fced301b442654dd8c23b3fc9","quantity":1,"product_tax_code":"","unit_price":"1","discount":"0"}],"plugin":"woo"}
03-29-2018 @ 19:04:53 - Received: {"tax":{"order_total_amount":7.65,"shipping":6.65,"taxable_amount":1.0,"amount_to_collect":0.08,"rate":0.0845,"has_nexus":true,"freight_taxable":false,"tax_source":"origin","breakdown":{"taxable_amount":1.0,"tax_collectable":0.08,"combined_tax_rate":0.0845,"state_taxable_amount":1.0,"state_tax_rate":0.047,"state_tax_collectable":0.05,"county_taxable_amount":1.0,"county_tax_rate":0.0185,"county_tax_collectable":0.02,"city_taxable_amount":1.0,"city_tax_rate":0.019,"city_tax_collectable":0.02,"special_district_taxable_amount":0.0,"special_tax_rate":0.0,"special_district_tax_collectable":0.0,"line_items":[{"id":"208-091d584fced301b442654dd8c23b3fc9","taxable_amount":1.0,"tax_collectable":0.08,"combined_tax_rate":0.0845,"state_taxable_amount":1.0,"state_sales_tax_rate":0.047,"state_amount":0.05,"county_taxable_amount":1.0,"county_tax_rate":0.0185,"county_amount":0.02,"city_taxable_amount":1.0,"city_tax_rate":0.019,"city_amount":0.02,"special_district_taxable_amount":0.0,"special_tax_rate":0.0,"special_district_amount":0.0}]}}}
03-29-2018 @ 19:04:53 - :: Adding New Tax Rate ::
03-29-2018 @ 19:04:53 - Array
(
    [tax_rate_country] => US
    [tax_rate_state] => UT
    [tax_rate_name] => UT Tax
    [tax_rate_priority] => 1
    [tax_rate_compound] => 
    [tax_rate_shipping] => 0
    [tax_rate] => 8.45
    [tax_rate_class] => 
)

03-29-2018 @ 19:04:53 - Tax Rate ID Set for 4
03-29-2018 @ 19:04:53 - :: Tax Rate Found ::
03-29-2018 @ 19:04:53 - Array
(
    [4] => Array
        (
            [rate] => 8.4500
            [label] => UT Tax
            [shipping] => no
            [compound] => no
        )

)

03-29-2018 @ 19:04:53 - :: Updating Tax Rate To ::
03-29-2018 @ 19:04:53 - Array
(
    [tax_rate_country] => US
    [tax_rate_state] => UT
    [tax_rate_name] => UT Tax
    [tax_rate_priority] => 1
    [tax_rate_compound] => 
    [tax_rate_shipping] => 0
    [tax_rate] => 8.45
    [tax_rate_class] => 
)

03-29-2018 @ 19:04:53 - Tax Rate ID Set for 4
03-29-2018 @ 19:04:53 - :::: TaxJar Plugin requested ::::
03-29-2018 @ 19:04:53 - :::: TaxJar API called ::::
03-29-2018 @ 19:04:53 - Received: {"tax":{"order_total_amount":7.65,"shipping":6.65,"taxable_amount":1.0,"amount_to_collect":0.08,"rate":0.0845,"has_nexus":true,"freight_taxable":false,"tax_source":"origin","breakdown":{"taxable_amount":1.0,"tax_collectable":0.08,"combined_tax_rate":0.0845,"state_taxable_amount":1.0,"state_tax_rate":0.047,"state_tax_collectable":0.05,"county_taxable_amount":1.0,"county_tax_rate":0.0185,"county_tax_collectable":0.02,"city_taxable_amount":1.0,"city_tax_rate":0.019,"city_tax_collectable":0.02,"special_district_taxable_amount":0.0,"special_tax_rate":0.0,"special_district_tax_collectable":0.0,"line_items":[{"id":"208-091d584fced301b442654dd8c23b3fc9","taxable_amount":1.0,"tax_collectable":0.08,"combined_tax_rate":0.0845,"state_taxable_amount":1.0,"state_sales_tax_rate":0.047,"state_amount":0.05,"county_taxable_amount":1.0,"county_tax_rate":0.0185,"county_amount":0.02,"city_taxable_amount":1.0,"city_tax_rate":0.019,"city_amount":0.02,"special_district_taxable_amount":0.0,"special_tax_rate":0.0,"special_district_amount":0.0}]}}}
03-29-2018 @ 19:04:53 - :: Tax Rate Found ::
03-29-2018 @ 19:04:53 - Array
(
    [4] => Array
        (
            [rate] => 8.4500
            [label] => UT Tax
            [shipping] => no
            [compound] => no
        )

)

03-29-2018 @ 19:04:53 - :: Updating Tax Rate To ::
03-29-2018 @ 19:04:53 - Array
(
    [tax_rate_country] => US
    [tax_rate_state] => UT
    [tax_rate_name] => UT Tax
    [tax_rate_priority] => 1
    [tax_rate_compound] => 
    [tax_rate_shipping] => 0
    [tax_rate] => 8.45
    [tax_rate_class] => 
)

03-29-2018 @ 19:04:53 - Tax Rate ID Set for 4
03-29-2018 @ 19:04:53 - :: Tax Rate Found ::
03-29-2018 @ 19:04:53 - Array
(
    [4] => Array
        (
            [rate] => 8.4500
            [label] => UT Tax
            [shipping] => no
            [compound] => no
        )

)

03-29-2018 @ 19:04:53 - :: Updating Tax Rate To ::
03-29-2018 @ 19:04:53 - Array
(
    [tax_rate_country] => US
    [tax_rate_state] => UT
    [tax_rate_name] => UT Tax
    [tax_rate_priority] => 1
    [tax_rate_compound] => 
    [tax_rate_shipping] => 0
    [tax_rate] => 8.45
    [tax_rate_class] => 
)

03-29-2018 @ 19:04:53 - Tax Rate ID Set for 4
03-29-2018 @ 19:04:57 - :::: TaxJar Plugin requested ::::
03-29-2018 @ 19:04:57 - :::: TaxJar API called ::::
03-29-2018 @ 19:04:57 - Received: {"tax":{"order_total_amount":7.65,"shipping":6.65,"taxable_amount":1.0,"amount_to_collect":0.08,"rate":0.0845,"has_nexus":true,"freight_taxable":false,"tax_source":"origin","breakdown":{"taxable_amount":1.0,"tax_collectable":0.08,"combined_tax_rate":0.0845,"state_taxable_amount":1.0,"state_tax_rate":0.047,"state_tax_collectable":0.05,"county_taxable_amount":1.0,"county_tax_rate":0.0185,"county_tax_collectable":0.02,"city_taxable_amount":1.0,"city_tax_rate":0.019,"city_tax_collectable":0.02,"special_district_taxable_amount":0.0,"special_tax_rate":0.0,"special_district_tax_collectable":0.0,"line_items":[{"id":"208-091d584fced301b442654dd8c23b3fc9","taxable_amount":1.0,"tax_collectable":0.08,"combined_tax_rate":0.0845,"state_taxable_amount":1.0,"state_sales_tax_rate":0.047,"state_amount":0.05,"county_taxable_amount":1.0,"county_tax_rate":0.0185,"county_amount":0.02,"city_taxable_amount":1.0,"city_tax_rate":0.019,"city_amount":0.02,"special_district_taxable_amount":0.0,"special_tax_rate":0.0,"special_district_amount":0.0}]}}}
03-29-2018 @ 19:04:57 - :: Tax Rate Found ::
03-29-2018 @ 19:04:57 - Array
(
    [4] => Array
        (
            [rate] => 8.4500
            [label] => UT Tax
            [shipping] => no
            [compound] => no
        )

)

03-29-2018 @ 19:04:57 - :: Updating Tax Rate To ::
03-29-2018 @ 19:04:57 - Array
(
    [tax_rate_country] => US
    [tax_rate_state] => UT
    [tax_rate_name] => UT Tax
    [tax_rate_priority] => 1
    [tax_rate_compound] => 
    [tax_rate_shipping] => 0
    [tax_rate] => 8.45
    [tax_rate_class] => 
)

03-29-2018 @ 19:04:57 - Tax Rate ID Set for 4
03-29-2018 @ 19:04:57 - :: Tax Rate Found ::
03-29-2018 @ 19:04:57 - Array
(
    [4] => Array
        (
            [rate] => 8.4500
            [label] => UT Tax
            [shipping] => no
            [compound] => no
        )

)

03-29-2018 @ 19:04:57 - :: Updating Tax Rate To ::
03-29-2018 @ 19:04:57 - Array
(
    [tax_rate_country] => US
    [tax_rate_state] => UT
    [tax_rate_name] => UT Tax
    [tax_rate_priority] => 1
    [tax_rate_compound] => 
    [tax_rate_shipping] => 0
    [tax_rate] => 8.45
    [tax_rate_class] => 
)

03-29-2018 @ 19:04:57 - Tax Rate ID Set for 4
03-29-2018 @ 19:05:04 - :::: TaxJar Plugin requested ::::
03-29-2018 @ 19:05:04 - :::: TaxJar API called ::::
03-29-2018 @ 19:05:04 - Received: {"tax":{"order_total_amount":7.65,"shipping":6.65,"taxable_amount":1.0,"amount_to_collect":0.08,"rate":0.0845,"has_nexus":true,"freight_taxable":false,"tax_source":"origin","breakdown":{"taxable_amount":1.0,"tax_collectable":0.08,"combined_tax_rate":0.0845,"state_taxable_amount":1.0,"state_tax_rate":0.047,"state_tax_collectable":0.05,"county_taxable_amount":1.0,"county_tax_rate":0.0185,"county_tax_collectable":0.02,"city_taxable_amount":1.0,"city_tax_rate":0.019,"city_tax_collectable":0.02,"special_district_taxable_amount":0.0,"special_tax_rate":0.0,"special_district_tax_collectable":0.0,"line_items":[{"id":"208-091d584fced301b442654dd8c23b3fc9","taxable_amount":1.0,"tax_collectable":0.08,"combined_tax_rate":0.0845,"state_taxable_amount":1.0,"state_sales_tax_rate":0.047,"state_amount":0.05,"county_taxable_amount":1.0,"county_tax_rate":0.0185,"county_amount":0.02,"city_taxable_amount":1.0,"city_tax_rate":0.019,"city_amount":0.02,"special_district_taxable_amount":0.0,"special_tax_rate":0.0,"special_district_amount":0.0}]}}}
03-29-2018 @ 19:05:04 - :: Tax Rate Found ::
03-29-2018 @ 19:05:04 - Array
(
    [4] => Array
        (
            [rate] => 8.4500
            [label] => UT Tax
            [shipping] => no
            [compound] => no
        )

)

03-29-2018 @ 19:05:04 - :: Updating Tax Rate To ::
03-29-2018 @ 19:05:04 - Array
(
    [tax_rate_country] => US
    [tax_rate_state] => UT
    [tax_rate_name] => UT Tax
    [tax_rate_priority] => 1
    [tax_rate_compound] => 
    [tax_rate_shipping] => 0
    [tax_rate] => 8.45
    [tax_rate_class] => 
)

03-29-2018 @ 19:05:04 - Tax Rate ID Set for 4
03-29-2018 @ 19:05:04 - :: Tax Rate Found ::
03-29-2018 @ 19:05:04 - Array
(
    [4] => Array
        (
            [rate] => 8.4500
            [label] => UT Tax
            [shipping] => no
            [compound] => no
        )

)

03-29-2018 @ 19:05:04 - :: Updating Tax Rate To ::
03-29-2018 @ 19:05:04 - Array
(
    [tax_rate_country] => US
    [tax_rate_state] => UT
    [tax_rate_name] => UT Tax
    [tax_rate_priority] => 1
    [tax_rate_compound] => 
    [tax_rate_shipping] => 0
    [tax_rate] => 8.45
    [tax_rate_class] => 
)

03-29-2018 @ 19:05:04 - Tax Rate ID Set for 4
03-29-2018 @ 19:05:08 - :::: TaxJar Plugin requested ::::
03-29-2018 @ 19:05:08 - :::: TaxJar API called ::::
03-29-2018 @ 19:05:08 - Received: {"tax":{"order_total_amount":7.65,"shipping":6.65,"taxable_amount":1.0,"amount_to_collect":0.08,"rate":0.0845,"has_nexus":true,"freight_taxable":false,"tax_source":"origin","breakdown":{"taxable_amount":1.0,"tax_collectable":0.08,"combined_tax_rate":0.0845,"state_taxable_amount":1.0,"state_tax_rate":0.047,"state_tax_collectable":0.05,"county_taxable_amount":1.0,"county_tax_rate":0.0185,"county_tax_collectable":0.02,"city_taxable_amount":1.0,"city_tax_rate":0.019,"city_tax_collectable":0.02,"special_district_taxable_amount":0.0,"special_tax_rate":0.0,"special_district_tax_collectable":0.0,"line_items":[{"id":"208-091d584fced301b442654dd8c23b3fc9","taxable_amount":1.0,"tax_collectable":0.08,"combined_tax_rate":0.0845,"state_taxable_amount":1.0,"state_sales_tax_rate":0.047,"state_amount":0.05,"county_taxable_amount":1.0,"county_tax_rate":0.0185,"county_amount":0.02,"city_taxable_amount":1.0,"city_tax_rate":0.019,"city_amount":0.02,"special_district_taxable_amount":0.0,"special_tax_rate":0.0,"special_district_amount":0.0}]}}}
03-29-2018 @ 19:05:08 - :: Tax Rate Found ::
03-29-2018 @ 19:05:08 - Array
(
    [4] => Array
        (
            [rate] => 8.4500
            [label] => UT Tax
            [shipping] => no
            [compound] => no
        )

)

03-29-2018 @ 19:05:08 - :: Updating Tax Rate To ::
03-29-2018 @ 19:05:08 - Array
(
    [tax_rate_country] => US
    [tax_rate_state] => UT
    [tax_rate_name] => UT Tax
    [tax_rate_priority] => 1
    [tax_rate_compound] => 
    [tax_rate_shipping] => 0
    [tax_rate] => 8.45
    [tax_rate_class] => 
)

03-29-2018 @ 19:05:08 - Tax Rate ID Set for 4
03-29-2018 @ 19:05:08 - :: Tax Rate Found ::
03-29-2018 @ 19:05:08 - Array
(
    [4] => Array
        (
            [rate] => 8.4500
            [label] => UT Tax
            [shipping] => no
            [compound] => no
        )

)

03-29-2018 @ 19:05:08 - :: Updating Tax Rate To ::
03-29-2018 @ 19:05:08 - Array
(
    [tax_rate_country] => US
    [tax_rate_state] => UT
    [tax_rate_name] => UT Tax
    [tax_rate_priority] => 1
    [tax_rate_compound] => 
    [tax_rate_shipping] => 0
    [tax_rate] => 8.45
    [tax_rate_class] => 
)

03-29-2018 @ 19:05:08 - Tax Rate ID Set for 4

Exempt Customers

Hey Everyone,

I can see thru the API Documentation that we can manage Exempt Customers.

Do plans exist to implement this into the Woo plugin? If so how? Can we help? As this is a feature we need for our use case.

No Street Address for Store Location Error

Handle this error more gracefully when a user does not have their store address set under Store Location in their Woo config:

PHP Notice: Undefined index: store_street in /wp-content/plugins/taxjar-simplified-taxes-for-woocommerce/includes/class-wc-taxjar-integration.php on line 1074

Sync doesn't work unless I enable Tax Calculation

I want to sync orders to TaxJar but I'm not yet ready to have tax calculated by this plugin for customers buying in my store.

I had the backfill queue full of old orders, they're all stuck at "Awaiting".

I believe the WC_Taxjar_Transaction_Sync::init() is not getting past the first line
if ( apply_filters( 'taxjar_enabled', isset( $this->taxjar_integration->settings['enabled'] ) && 'yes' == $this->taxjar_integration->settings['enabled'] ) ) {

Is this by design? I don't understand why you can't allow me to sync orders until I enable. I would think that you should be checking the "taxjar_download" setting instead (and change the filter name to match):
if ( apply_filters( 'taxjar__download_enabled', isset( $this->taxjar_integration->settings['taxjar_download'] ) && 'yes' == $this->taxjar_integration->settings['taxjar_download'] ) ) {

Taxes for the Canary Islands

Its calculating the taxes for the Canary Islands ( which are part of Spain ) as if it was Spain ( 21% )
The Canary Islands is a "Special Tax Region" where the tax applied is called IGIC and is only 7%

Save Exempt Reason to Order

It would be great if a customer is exempt, that we save the reason to the order as metadata. This way if the customer exemption changes later, we can still see why the tax was $0 at the time of the order.

No tax calculated when county has two words

Using a UK address, the county field is optional. When filled in with just one word (i.e. Sussex), tax is calculated correctly:

County - one word
Full size: https://cld.wthms.co/JeY97i

If a second word is added (i.e. West Sussex), the tax is 0:

County - two words
Full size: https://cld.wthms.co/HItOdA

This continues with other examples - setting county to "test" returns the correct tax rate, while "test test" returns a zero rate.

Confirmed on both a customer live site and a test site using WooCommerce Services (TaxJar).

2126459-zen

to_street is not being sent for SSG state calculations

Currently, SSG states require a street address to return a correct tax rate, otherwise a lower rate is returned. The correct rate is calculated for tax payments, resulting in a under collection at time of purchase. Needs to add to_street parameter to the api request.

Support for WordPress Rest API

I would love to see support for WordPress Rest API:

  • Sync all users to Taxjar
  • Sync individual user to Taxjar
  • Sync Transactions
    ...

Tax exempt customer has taxes applied to subscription and renewals

We have a customer that with a tax exemption set in their profile:
Screen Shot 2021-04-20 at 3 01 01 PM

They have been getting charged tax on their subscription renewals, even though they are tax exempt.

If I remove the product from their subscription and add it fresh there are no taxes. But when "Recalculate" is done, the taxes are added.

go6xYpPiIJ

How can we ensure that all our tax exempt customers are not charged tax on their subscriptions?

Exempt orders adding 0.00% zip code entries

Hello,

We are noticing that exempt orders are erroneously adding zero percent entries in the Standard Tax Rates table. Shouldn't new entries only be added to this table when non-exempt orders are placed?

Please let us know ASAP if this is a bug, and if not, what would be the use case for the plugin behaving this way?

Undefined Index error?

I get the following error:

Notice: Undefined index: enabled in /wp-content/plugins/taxjar-simplified-taxes-for-woocommerce/includes/class-wc-taxjar-integration.php on line 42

Any tips on what is going on here? I read that I need to add "isset" somewhere on that line, but I'm not much of a programmer.

Version of action-scheduler?

We are having an issue on our site where webhooks on subscription updates are sometimes getting the wrong status. WooCommerce support asked us to search the plugin code to look for anything adjusting the number of concurrent batches in action scheduler.

They saw the library/action-scheduler in the taxjar plugin and pointed out that it had a defualt of 5 concurrent batches as opposed to 1 in the official action-scheduler.

What version of action-scheduler is TaxJar using in the plugin? Is the code in the library only used if the system doesn't have action-scheduler running, or is it using the code all the time? If so, can the number of concurrent batches be updated to match the current action-scheduler, or maybe better, can the included version be updated to the lastest v3.1.6 instead of 2.2.5 that is in there, or would that cause other issues?

Fatal error when store processes subscription renewal

I am encountering a fatal error in this plugin when a subscription renewal order is processed. The error in question appears to be the same as in issue #192, though the circumstances surrounding it are different.

One of the store's automatic subscription renewals failed, generating a notice in WordPress. When I tried to follow the documentation steps (https://docs.woocommerce.com/document/subscriptions/scheduled-action-errors/) and manually renew the subscription, I received the following PHP error:

Fatal error: Uncaught Error: Call to a member function get_tax_rate() on bool in /nas/content/live/tkmgacademy/wp-content/plugins/taxjar-simplified-taxes-for-woocommerce/includes/TaxCalculation/class-order-tax-applicator.php:151 Stack trace: #0 /nas/content/live/tkmgacademy/wp-content/plugins/taxjar-simplified-taxes-for-woocommerce/includes/TaxCalculation/class-order-tax-applicator.php(111): TaxJar\Order_Tax_Applicator->get_product_line_item_tax_rate(3569, Object(WC_Order_Item_Product)) #1 /nas/content/live/tkmgacademy/wp-content/plugins/taxjar-simplified-taxes-for-woocommerce/includes/TaxCalculation/class-order-tax-applicator.php(93): TaxJar\Order_Tax_Applicator->create_product_tax_rate(3569, Object(WC_Order_Item_Product)) #2 /nas/content/live/tkmgacademy/wp-content/plugins/taxjar-simplified-taxes-for-woocommerce/includes/TaxCalculation/class-order-tax-applicator.php(82): TaxJar\Order_Tax_Applicator->create_rate_and_apply_to_product_line_item(3569, Object(WC_Order_Item_Product)) #3 /nas/content/live/tkmgacademy/wp-conten in /nas/content/live/tkmgacademy/wp-content/plugins/taxjar-simplified-taxes-for-woocommerce/includes/TaxCalculation/class-order-tax-applicator.php on line 151

The only line item in this order is a variable subscription product, with no sales tax collected on it.

Some additional background is that this store was switched from AvaTax to TaxJar earlier this month. I tested on a staging site to see if this switch might be a cause of this issue and was not able to recreate it so it appears to be something else.

Plugin versions:

WordPress: 5.7.2
WooCommerce: 5.4.2
TaxJar: 3.2.10

Let me know if there's any other info I can provide to help resolve this issue.

Total price at the checkout not calculated correctly if shipping method is not taxable

Related issue in WooCommerce Services: Automattic/woocommerce-services#1309

To reproduce:

  • use WooCommerce 3.3.1
  • set up a store in a state that taxes shipping (for example NC)
  • add a Flat Rate shipping method and set its taxable status to None
  • checkout a product
  • the tax row shows the tax for both the item and shipping but the total only includes the item tax:

screen shot 2018-02-15 at 19 49 34

In this scenario either the taxable setting on the shipping method should be ignored or the tax row should not include shipping tax.

CC @jeffstieler

Incompatability with Smart Coupons store credits

We're experiencing the same issue that appeared to have been fixed in April with PR #98 but we are experiencing them today with the latest versions of all plugins.

To isolate the issue from our custom code, I spun up a limited test environment with the following installed:

WordPress 5.2.3
WooCommerce 3.7.1
WooCommerce Subscriptions 2.6.1
WooCommerce Stripe Gateway 4.2.5
WooCommerce Smart Coupons 4.3.0
Tax Jar 3.0.10

As soon as calculations with TaxJar are enabled, the store credit Smart Coupon stops applying the credit to orders. Here's a screenshot:

Before enabling: https://cl.ly/d46679997790
After enabling: https://cl.ly/b97eca8be0f4

Steps to reproduce:

  1. Add this product to cart
  2. Add a shipping city/state/zip on cart page
  3. Apply coupon code 577ed3q3aminc (should be a store credit for $80)

This is a critical piece of a new feature we're in the process of rolling out for TBR. I'm happy to assist in any way I can with testing code changes, etc. Thank you!

Bug in total when using product add-ons extension

From Automattic/woocommerce-services#1255 (cc: @n-dawson)

There's a bug that occurs when using the product add-ons extension
(https://woocommerce.com/products/product-add-ons/) which leads to an incorrect figure being shown for tax on the order.

The product add-ons extension allow you to add personalisation options to products such as a text field. The issue happens when you add the same product to your cart more than once with different personalisation options. The cart will show the product as individual line items rather than the same product with an increased quantity. This means the products all have identical IDs and quantities.

I've pulled a request from the WooCommerce Services log that matches the conditions outlined above:
{"from_country":"US","from_state":"MA","from_city":"REMOVED","from_zip":"00000","to_country":"US","to_state":"MA","to_city":"REMOVED","to_zip":"00000","shipping":"0","line_items":[{"id":257,"quantity":1,"product_tax_code":"","unit_price":"65","discount":"13"},{"id":257,"quantity":1,"product_tax_code":"","unit_price":"65","discount":"13"},{"id":257,"quantity":1,"product_tax_code":"","unit_price":"65","discount":"13"}],"plugin":"woo"} (WCS Tax)

The response:
Received: {"tax":{"order_total_amount":52.0,"shipping":0.0,"taxable_amount":52.0,"amount_to_collect":3.25,"rate":0.0625,"has_nexus":true,"freight_taxable":false,"tax_source":"destination","breakdown":{"taxable_amount":52.0,"tax_collectable":3.25,"combined_tax_rate":0.0625,"state_taxable_amount":52.0,"state_tax_rate":0.0625,"state_tax_collectable":3.25,"county_taxable_amount":0.0,"county_tax_rate":0.0,"county_tax_collectable":0.0,"city_taxable_amount":0.0,"city_tax_rate":0.0,"city_tax_collectable":0.0,"special_district_taxable_amount":0.0,"special_tax_rate":0.0,"special_district_tax_collectable":0.0,"line_items":[{"id":"257","taxable_amount":52.0,"tax_collectable":3.25,"combined_tax_rate":0.0625,"state_taxable_amount":52.0,"state_sales_tax_rate":0.0625,"state_amount":3.25,"county_taxable_amount":0.0,"county_tax_rate":0.0,"county_amount":0.0,"city_taxable_amount":0.0,"city_tax_rate":0.0,"city_amount":0.0,"special_district_taxable_amount":0.0,"special_tax_rate":0.0,"special_district_amount":0.0}]}}} (WCS Tax)

The response appears to show the line items were treated as duplicates. Instead of recognising the order total as $156, it's returned as $52. The amount to collect is for a single product, not the whole order.

Example from the checkout page:
screenshot 2017-12-07 21 10 59

The order total is correct, it's accounting for tax on both products. It's just the tax figure that's wrong.

Incorrect 0% rates added to Standard rates tax class

When the order/cart only contains items that of service tax class/codes incorrect 0% tax rates are being added to the Standard rates. The offending code is here.

If the items are all exempt then the tax rate returned by that SmartCalcs request is 0%. But the code inserts it into the Standard rates class. That 0% rate was meant for the exempt items and shouldn't go in Standard rates.

woocommerce_after_calculate_totals action is not performed after totals are recalculated by the plugin

Related issue reported in WooCommerce Services: Automattic/woocommerce-services#1471

The smart coupons plugin is using the woocommerce_after_calculate_totals hook to apply its discounts. But the action is not called when the TaxJar plugin recalculates the totals, which results in an erroneous behaviour of that and potentially other plugins.

A potential solution would be to add something like this after the call to WC_Cart_Totals:

remove_action( 'woocommerce_after_calculate_totals', array( $this, 'calculate_totals' ), 20 );
do_action( 'woocommerce_after_calculate_totals', $wc_cart_object );
add_action( 'woocommerce_after_calculate_totals', array( $this, 'calculate_totals' ), 20 );

CC @jeffstieler

No tax calculated in checkout

If the user does not calculate shipping on the cart page and goes to checkout, no tax is ever calculated. Even after filling out the billing area. Suggest javascript that checks country/state/zip when any of those fields change and ajax to change tax area.

Dynamic tax category filter

My company sells a service that TaxJar does not yet have a tax a tax category for. As a workaround we set the product's tax class as "General Services - 19000" and added a few lines to get_line_items() in class-wc-taxjar-integration.php so that in some states TaxJar will treat the product as fully taxable instead of general services. This simulates the tax behavior of our service.

// In function get_line_items ...
	if ( isset( $tax_class ) && is_numeric( end( $tax_class ) ) ) {
		$tax_code = end( $tax_class );

		//// Treat general services as regular product in some states
		if ($tax_code === '19000') {
			$address = $this->get_address($wc_cart_object);
			if ($address['to_state'] && in_array($address['to_state'], ['AL', 'AK', 'AZ', 'AR'])) {
				$tax_code = '';
			}
		}
		//////////////////////////////////////////////////////////////////////////////////////////////
	}

Would you be willing to add a filter to the plugin so that we can move this code out of the taxjar plugin and put it cleanly in an other plugin or in functions.php? I imagine others might be in a similar situation where the categories taxjar provides aren't sufficient and they need to implement some kind of dynamic tax code logic.

Something like this might work...

add_filter('taxjar_get_line_items', function($line_items, $wc_cart_object){
	// Manipulate tax code for each line item
	return $line_items;
});

Set a more specific tax name so the Taxes report is less ambiguous

Issue reported in WooCommerce Services: Automattic/woocommerce-services#1620

For an order with auto-calculated taxes, TaxJar gives a name to the tax rate using this logic. So, for example, when a customer from Dallas, TX buys an item, the order has a tax rate called TX Tax.

On the WooCommerce -> Reports -> Taxes table (http://[YOUR-SITE]/wp-admin/admin.php?page=wc-reports&tab=taxes), that tax rate will have this code: US-TX-TX TAX-1. Even if the site gets orders from different customers from differents parts of Texas, all the different tax rates will have the same US-TX-TX TAX-1 name. That makes reporting quite confusing.

The Reports -> Taxes table uses this logic to set a tax name (see here): [COUNTRY]-[STATE]-[TAX_NAME]-[PRIORITY]. The "tax name" produced by TaxJar should have a more specific name, for example Dallas Tax. In that case, the report would read US-TX-DALLAS TAX-1, which is less ambiguous.

API key generation does not work for WooCommerce 2.4

The function to generate the WooCommerce api key and secret (generate_v1_api_keys) does not work with the new api changes in WooCommerce 2.4+.

Instead of generating the old style, when a user has WooCommerce 2.4 installed, the plugin should at a minimum hide the old style keys and include instructions to manually create the 2.4 keys.

More in depth idea would be to provide a button to generate them automatically and popup the one time use display of them to copy and paste?

Exempt Customers API

It would be useful if the TaxJar api showed a timestamp for one an exempt customer was created or last modified.

I also notice in the UI you can upload a cert file, any plans to have that added to the api as well?

Feature Request - Webhooks

So I know this may not be the best place, but we would love to see taxjar offer webhooks. On the WordPress site, maybe just hooking into WooCommerce webhooks feature to show what options are best available, such as syncing a customer, etc. But we would really like to see webhooks via the native TaxJar experience, not specific to WordPress.

Skip tax calculation on $0 orders

Our store generates a large amount of $0 subscription renewals every month. These are gift subscriptions that have an upfront (prepaid) signup fee, and then renew every month for a specific number of months.

The calculate_renewal_order_totals method is run for each of these renewals, which calls calculate_order_tax to make an API call to TaxJar, and then update the order totals.

Because we process such a large amount of $0 orders (75,000+ on a single day ever month), it would be great if we could avoid the performance hit of an API call and tax calculations.

There's a couple of options for implementation.

Option A

We could specifically exclude these $0 orders directly in the calculate_renewal_order_totals and calculate_order_tax methods, which would benefit everyone processing $0 orders who uses this TaxJar plugin.

// Skip tax calculation order total is 0.
if ( 0 == $order->get_total() ) {
    return;
}

I think of a case where a shop would need to calculate tax on a $0 order, but maybe it exists?

Option B

We could add filters to the calculate_renewal_order_totals and calculate_order_tax methods, which would allow developers to eject from tax calculation whenever an order meets a specific criteria. This would allow us to return early if the order is $0, and also provide flexibility for other use cases developers may have.

// Calculate TaxJar taxes for renewal order unless overridden by filter.
if ( ! apply_filters( 'taxjar_subscription_renewal_order_should_calculate_tax', true, $order, $subscription ) ) {
    return $order;
}
// Calculate TaxJar taxes for order unless overridden by filter.
if ( ! apply_filters( 'taxjar_order_should_calculate_tax', true, $order ) ) {
    return;
}

I can't think of a downside for this option.

Option C

Combine Option A + Option B, to automatically exclude $0 orders from tax calculation and provide the additional flexibility in case any developers need it down the line.

--

I plan to create a PR for Option C, but can limit it to Option A or Option B if you have concerns about any of the implementations.

Let me know if you have any questions or feedback!

Dev/Staging Sites - Disable Sync

@dallendalton

So for our site we have been noticing some issues with syncing exemptions to TaxJar. One thing I would like to rule out is local dev and staging servers syncing. What is the best way to disable sync now on these installs?

Can we have a setting in the plugin to set the site as dev/staging and disable the user exemption syncing?

Programatically updating subscriptions with WooCommerce Subscriptions

I work as a developer on TBR. We offer our subscription product in both physical and digital forms and collect tax on neither, one or both depending on the jurisdiction. We allow customers to switch subscription levels. To maintain control of the UX, we've making the switches programmatically with PHP:

Here's out current setup:

WordPress 5.4.2
WooCommerce 4.6.1
WooCommerce Subscriptions 3.09
TaxJar 3.2.3

This is roughly the code we're using to make the switch (there's some code above that determine whether the switch is allowed and adds shipping info for subscriptions that need it):

$subscription = new WC_Subscription($_POST['subscription']);
$variation = new WC_Product_Variation($variation_id);

$subscription->remove_order_items();
$subscription->add_product($variation);

if($_POST['phys'] == 'physical') {
    $shipping_rate = new WC_Shipping_Rate();
    if($_POST['freq'] == 'quarterly') {
        $shipping_rate->set_cost(floatval(PHYSICAL_QUARTERLY_SHIPPING));
    }
    $subscription->add_shipping($shipping_rate);
}

$subscription->set_billing_interval($interval);
$subscription->set_billing_period($period);

$subscription->calculate_totals();
$subscription->save();

When I built this out originally, I noted that calculate_totals() calls calculate_taxes() which I assumed TaxJar hooked into. I've been looking into the code and it appears that it works differently. We've had a few instances now where someone has switched from a untaxed to a taxed product and not been charged tax when their renewal processed.

Can you point me to how I'd go about doing this? Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.