taxjar / taxjar-woocommerce-plugin

WooCommerce Sales Tax Plugin by TaxJar
http://www.taxjar.com/woocommerce-sales-tax-plugin/
GNU General Public License v2.0
30 stars 29 forks source link

Calculate totals(tax) on order doesn't consider the "Local Pickup" shipping method. #229

Closed iamdharmesh closed 2 years ago

iamdharmesh commented 2 years ago

During checking compatibility with the Deposits plugin, I came across this issue.

When using the "Local Pickup" shipping method, taxes are calculated properly in the front-end checkout process and it's saved correctly in order as well. but if we calculate totals of order using $order->calculate_totals( true );, the tax didn't get calculated correctly.

For the "Local Pickup" shipping method, tax should be calculated based on store address(base) which is handled properly in Cart_Tax_Request_Body_Builder::get_ship_to_address here, So its working fine throughout the checkout process but, at the other hand, "Local Pickup" is ignored in Order_Tax_Request_Body_Builder::get_ship_to_addresshere and it will always consider the shipping/billing address to calculate tax.

Deposits plugin calculates order totals on woocommerce_checkout_create_order action hooks to include the deposit adjustments and it triggers TaxJar_Tax_Calculation->maybe_calculate_order_taxes() function hooked on woocommerce_order_after_calculate_totals action. So, order tax get calcuted based on shipping/billing address and order totals differ from what it showing at checkout.

I believe considering the "Local Pickup" shipping method in Order_Tax_Request_Body_Builder::get_ship_to_addresshere will fix the issue OR maybe add action/filter hook in function will allow us to fix the issue.

Please let me know if any further information is needed on this.

Thanks

sethobey-stripe commented 2 years ago

@iamdharmesh Thank you for submitting this issue. We are investigating and will post an update once we have one.

dallendalton commented 2 years ago

This issue has been resolved in the latest release. Thanks!