total calcs
This commit is contained in:
parent
51aba21d76
commit
0d8d95e8e6
|
@ -471,7 +471,7 @@ jQuery( function($){
|
|||
tax = parseFloat( accounting.toFixed( tax, woocommerce_admin_meta_boxes.rounding_precision ) );
|
||||
|
||||
// Set Total
|
||||
$('#_order_total').val( parseFloat( accounting.toFixed( line_totals + tax + shipping - order_discount, woocommerce_admin_meta_boxes.rounding_precision ) ) ).change();
|
||||
$('#_order_total').val( parseFloat( accounting.toFixed( line_totals + tax + shipping - order_discount, woocommerce_admin_meta_boxes.currency_format_num_decimals ) ) ).change();
|
||||
}
|
||||
|
||||
$('#woocommerce-order-totals').unblock();
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1134,6 +1134,10 @@ class WC_Cart {
|
|||
}
|
||||
|
||||
// Tax rows - merge the totals we just got
|
||||
if ( ! $this->round_at_subtotal ) {
|
||||
$discounted_taxes = array_map( 'woocommerce_round_tax_total', $discounted_taxes );
|
||||
}
|
||||
|
||||
foreach ( array_keys( $this->taxes + $discounted_taxes ) as $key ) {
|
||||
$this->taxes[ $key ] = ( isset( $discounted_taxes[ $key ] ) ? $discounted_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
|
||||
}
|
||||
|
@ -1154,6 +1158,10 @@ class WC_Cart {
|
|||
$line_total = $tax_result['price_excl_tax'];
|
||||
|
||||
// Tax rows - merge the totals we just got
|
||||
if ( ! $this->round_at_subtotal ) {
|
||||
$discounted_taxes = array_map( 'woocommerce_round_tax_total', $discounted_taxes );
|
||||
}
|
||||
|
||||
foreach ( array_keys( $this->taxes + $discounted_taxes ) as $key ) {
|
||||
$this->taxes[ $key ] = ( isset( $discounted_taxes[ $key ] ) ? $discounted_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
|
||||
}
|
||||
|
|
|
@ -164,7 +164,13 @@ function woocommerce_trim_zeros( $price ) {
|
|||
*/
|
||||
function woocommerce_round_tax_total( $tax ) {
|
||||
$dp = (int) get_option( 'woocommerce_price_num_decimals' );
|
||||
return round( $tax, $dp, WOOCOMMERCE_TAX_ROUNDING_MODE );
|
||||
|
||||
if ( version_compare( phpversion(), '5.3', '<' ) ) {
|
||||
$tax = round( $tax, $dp );
|
||||
} else {
|
||||
$tax = round( $tax, $dp, WOOCOMMERCE_TAX_ROUNDING_MODE );
|
||||
}
|
||||
return $tax;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1295,8 +1295,8 @@ function woocommerce_calc_line_taxes() {
|
|||
$item['name'] = $tax_codes[ $key ];
|
||||
$item['label'] = $tax->get_rate_label( $key );
|
||||
$item['compound'] = $tax->is_compound( $key ) ? 1 : 0;
|
||||
$item['tax_amount'] = $tax->round( isset( $taxes[ $key ] ) ? $taxes[ $key ] : 0 );
|
||||
$item['shipping_tax_amount'] = $tax->round( isset( $shipping_taxes[ $key ] ) ? $shipping_taxes[ $key ] : 0 );
|
||||
$item['tax_amount'] = woocommerce_format_decimal( woocommerce_round_tax_total( isset( $taxes[ $key ] ) ? $taxes[ $key ] : 0 ), false );
|
||||
$item['shipping_tax_amount'] = woocommerce_format_decimal( woocommerce_round_tax_total( isset( $shipping_taxes[ $key ] ) ? $shipping_taxes[ $key ] : 0 ), false );
|
||||
|
||||
if ( ! $item['label'] )
|
||||
$item['label'] = $woocommerce->countries->tax_or_vat();
|
||||
|
|
|
@ -126,7 +126,7 @@ final class WooCommerce {
|
|||
define( 'WOOCOMMERCE_VERSION', $this->version );
|
||||
define( 'WOOCOMMERCE_TEMPLATE_PATH', $this->template_path() );
|
||||
define( 'WOOCOMMERCE_ROUNDING_PRECISION', 4 );
|
||||
define( 'WOOCOMMERCE_TAX_ROUNDING_MODE', PHP_ROUND_HALF_DOWN );
|
||||
define( 'WOOCOMMERCE_TAX_ROUNDING_MODE', 2 ); // 2 = PHP_ROUND_HALF_DOWN
|
||||
if ( ! defined( 'WOOCOMMERCE_DELIMITER' ) )
|
||||
define( 'WOOCOMMERCE_DELIMITER', '|' );
|
||||
|
||||
|
|
Loading…
Reference in New Issue