VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: mrooksads on June 21, 2016, 17:41:31 PM

Title: How to not calculate tax until shipping state is selected
Post by: mrooksads on June 21, 2016, 17:41:31 PM
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.
Title: Re: How to not calculate tax until shipping state is selected
Post by: GJC Web Design on June 21, 2016, 18:09:02 PM
if your on VM3.0.16 you can filter (I think only bill tax) by States
Title: Re: How to not calculate tax until shipping state is selected
Post by: mrooksads on June 21, 2016, 18:20:31 PM
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.
Title: Re: How to not calculate tax until shipping state is selected
Post by: mrooksads on June 21, 2016, 18:24:24 PM
Joomla 3.5.0
Virtuemart 3.0.16
Title: Re: How to not calculate tax until shipping state is selected
Post by: mrooksads on June 21, 2016, 20:15:20 PM
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.
Title: Re: How to not calculate tax until shipping state is selected
Post by: mrooksads on June 21, 2016, 20:42:48 PM
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?
Title: Re: How to not calculate tax until shipping state is selected
Post by: mrooksads on June 21, 2016, 21:40:41 PM
This doesn't resolve the tax calculating in the total, so it's not solution at all.