News:

Support the VirtueMart project and become a member

Main Menu

How to not calculate tax until shipping state is selected

Started by mrooksads, June 21, 2016, 17:41:31 PM

Previous topic - Next topic

mrooksads

By default, the tax is added to the price even if the customer has not added selected their US State.
I only collecting tax for Florida, so I don't want any tax calculated unless the customer selects Florida for their shipping state.
How do we configure Virtuemart to not calculate tax until shipping state is selected.

GJC Web Design

if your on VM3.0.16 you can filter (I think only bill tax) by States
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

mrooksads

I am collecting tax per product, as tax only applies to two product types, the other product types tax does not apply.

I have already configured the tax rule. It applies only to Florida state tax. The calculation seems to work as expected, but the problem is the tax is applied by default, prior to selecting your state.

The tax is added to the cart until you select your state. Once you select your state, if it is not Florida, then the tax is removed. If it is Florida, the tax remains.

I need the tax to not display by default, and only display after the state is selected.

mrooksads


mrooksads

I've installed a template hack the produces the required result.

In com_virtuemart > views > cart > tmpl > default_pricelist.php

Wrap each tax value output in the following:
<!-- // remove tax --------------------------------------------------->
<?php if (!empty($this->cart->BT)){ ?>
Wrap will hide this
<?php } ?>

This removes references to tax in the cart until a billing address has been entered.
There are about 5 or so tax value references in the page, so you need to wrap each reference.
Here is an example of one reference:

Before:
<?php if (VmConfig::get ('show_tax')) { ?>
   <td align="right"><?php echo "<span  class='priceColor2'>" . $this->currencyDisplay->createPriceDiv ('paymentTax', '', $this->cart->cartPrices['paymentTax'], FALSE) . "</span>"; ?></td>

After:
<?php if (VmConfig::get ('show_tax')) { ?>
   <td align="right">
<!-- // remove tax --------------------------------------------------->
<?php if (!empty($this->cart->BT)){ ?>
<?php echo "<span  class='priceColor2'>" . $this->currencyDisplay->createPriceDiv ('paymentTax', '', $this->cart->cartPrices['paymentTax'], FALSE) . "</span>"; ?>
<?php } ?>
</td>

Make sure you wrap the value inside the table td, or you will hide the table cell which will break the layout. You only want to hide the tax values.

mrooksads

I would like to know a better way to do this, I'm sure hacking the template is not the best method.

Shouldn't this functionality be built in?

mrooksads

This doesn't resolve the tax calculating in the total, so it's not solution at all.