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_addresshere, 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.
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 inCart_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 inOrder_Tax_Request_Body_Builder::get_ship_to_address
here 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 triggersTaxJar_Tax_Calculation->maybe_calculate_order_taxes()
function hooked onwoocommerce_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_address
here 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