Option to hide tax on cart page. Closes #469.
This commit is contained in:
parent
babe65bb19
commit
55222422c6
|
@ -743,6 +743,14 @@ $woocommerce_settings['tax'] = apply_filters('woocommerce_tax_settings', array(
|
|||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'start'
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Display taxes on cart page', 'woocommerce' ),
|
||||
'id' => 'woocommerce_display_cart_taxes',
|
||||
'std' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => ''
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Round tax at subtotal level, instead of per line', 'woocommerce' ),
|
||||
|
|
|
@ -921,6 +921,12 @@ class woocommerce_cart {
|
|||
$this->tax_total = array_sum( $this->taxes );
|
||||
endif;
|
||||
|
||||
// VAT exemption done at this point - so all totals are correct before exemption
|
||||
if ($woocommerce->customer->is_vat_exempt()) :
|
||||
$this->shipping_tax_total = $this->tax_total = 0;
|
||||
$this->taxes = array();
|
||||
endif;
|
||||
|
||||
// Cart Discounts (after tax)
|
||||
$this->apply_cart_discounts_after_tax();
|
||||
|
||||
|
@ -929,15 +935,15 @@ class woocommerce_cart {
|
|||
|
||||
// Cart Shipping
|
||||
$this->calculate_shipping();
|
||||
|
||||
// Taxes Rounding - taxes now include shipping taxes
|
||||
$this->taxes = $this->tax->get_taxes_rounded( $this->taxes );
|
||||
|
||||
// VAT exemption done at this point - so all totals are correct before exemption
|
||||
// VAT exemption done again to wipe shipping tax
|
||||
if ($woocommerce->customer->is_vat_exempt()) :
|
||||
$this->shipping_tax_total = $this->tax_total = 0;
|
||||
$this->taxes = array();
|
||||
endif;
|
||||
|
||||
// Taxes Rounding - taxes now include shipping taxes
|
||||
$this->taxes = $this->tax->get_taxes_rounded( $this->taxes );
|
||||
|
||||
// Allow plugins to hook and alter totals before final total is calculated
|
||||
do_action('woocommerce_calculate_totals', $this);
|
||||
|
@ -1174,6 +1180,13 @@ class woocommerce_cart {
|
|||
return woocommerce_price($this->total);
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the total excluding taxes
|
||||
*/
|
||||
function get_total_ex_tax() {
|
||||
return woocommerce_price( $this->total - $this->tax_total - $this->shipping_tax_total );
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the cart contents total (after calculation)
|
||||
*/
|
||||
|
|
|
@ -88,7 +88,7 @@ $available_methods = $woocommerce->shipping->get_available_shipping_methods();
|
|||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
if ($woocommerce->cart->get_cart_tax()) :
|
||||
if (get_option('woocommerce_display_cart_taxes')=='yes' && $woocommerce->cart->get_cart_tax()) :
|
||||
|
||||
if (isset($woocommerce->cart->taxes) && sizeof($woocommerce->cart->taxes)>0) :
|
||||
|
||||
|
@ -149,7 +149,15 @@ $available_methods = $woocommerce->shipping->get_available_shipping_methods();
|
|||
|
||||
<tr class="total">
|
||||
<th><strong><?php _e('Order Total', 'woocommerce'); ?></strong></th>
|
||||
<td><strong><?php echo $woocommerce->cart->get_total(); ?></strong></td>
|
||||
<td><strong><?php
|
||||
|
||||
if (get_option('woocommerce_display_cart_taxes')=='no' && !$woocommerce->cart->prices_include_tax) :
|
||||
echo $woocommerce->cart->get_total_ex_tax();
|
||||
else :
|
||||
echo $woocommerce->cart->get_total();
|
||||
endif;
|
||||
|
||||
?></strong></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
|
|
Loading…
Reference in New Issue