Rounding order_tax and order_shipping_tax restricts our ability to get an accurate tax_total after an order is made. Fixes some paypal rounding requests.

@coenjacobs
This commit is contained in:
Mike Jolley 2014-02-20 15:41:08 +00:00 committed by Coen Jacobs
parent 465b9b9d5f
commit a215a94f5d
3 changed files with 5 additions and 5 deletions

View File

@ -269,8 +269,8 @@ class WC_Meta_Box_Order_Totals {
} }
// Update totals // Update totals
update_post_meta( $post_id, '_order_tax', wc_round_tax_total( $total_tax ) ); update_post_meta( $post_id, '_order_tax', wc_format_decimal( $total_tax ) );
update_post_meta( $post_id, '_order_shipping_tax', wc_round_tax_total( $total_shipping_tax ) ); update_post_meta( $post_id, '_order_shipping_tax', wc_format_decimal( $total_shipping_tax ) );
update_post_meta( $post_id, '_order_discount', wc_format_decimal( $_POST['_order_discount'] ) ); update_post_meta( $post_id, '_order_discount', wc_format_decimal( $_POST['_order_discount'] ) );
update_post_meta( $post_id, '_order_total', wc_format_decimal( $_POST['_order_total'] ) ); update_post_meta( $post_id, '_order_total', wc_format_decimal( $_POST['_order_total'] ) );

View File

@ -373,8 +373,8 @@ class WC_Checkout {
update_post_meta( $order_id, '_order_shipping', wc_format_decimal( WC()->cart->shipping_total ) ); update_post_meta( $order_id, '_order_shipping', wc_format_decimal( WC()->cart->shipping_total ) );
update_post_meta( $order_id, '_order_discount', wc_format_decimal( WC()->cart->get_order_discount_total() ) ); update_post_meta( $order_id, '_order_discount', wc_format_decimal( WC()->cart->get_order_discount_total() ) );
update_post_meta( $order_id, '_cart_discount', wc_format_decimal( WC()->cart->get_cart_discount_total() ) ); update_post_meta( $order_id, '_cart_discount', wc_format_decimal( WC()->cart->get_cart_discount_total() ) );
update_post_meta( $order_id, '_order_tax', wc_format_decimal( wc_round_tax_total( WC()->cart->tax_total ) ) ); update_post_meta( $order_id, '_order_tax', wc_format_decimal( WC()->cart->tax_total ) );
update_post_meta( $order_id, '_order_shipping_tax', wc_format_decimal( wc_round_tax_total( WC()->cart->shipping_tax_total ) ) ); update_post_meta( $order_id, '_order_shipping_tax', wc_format_decimal( WC()->cart->shipping_tax_total ) );
update_post_meta( $order_id, '_order_total', wc_format_decimal( WC()->cart->total, get_option( 'woocommerce_price_num_decimals' ) ) ); update_post_meta( $order_id, '_order_total', wc_format_decimal( WC()->cart->total, get_option( 'woocommerce_price_num_decimals' ) ) );
update_post_meta( $order_id, '_order_key', 'wc_' . apply_filters('woocommerce_generate_order_key', uniqid('order_') ) ); update_post_meta( $order_id, '_order_key', 'wc_' . apply_filters('woocommerce_generate_order_key', uniqid('order_') ) );

View File

@ -357,7 +357,7 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
if ( ( $order->get_total_shipping() + $order->get_shipping_tax() ) > 0 ) { if ( ( $order->get_total_shipping() + $order->get_shipping_tax() ) > 0 ) {
$paypal_args['item_name_2'] = __( 'Shipping via', 'woocommerce' ) . ' ' . ucwords( $order->get_shipping_method() ); $paypal_args['item_name_2'] = __( 'Shipping via', 'woocommerce' ) . ' ' . ucwords( $order->get_shipping_method() );
$paypal_args['quantity_2'] = '1'; $paypal_args['quantity_2'] = '1';
$paypal_args['amount_2'] = number_format( $order->get_total_shipping() + $order->get_shipping_tax() , 2, '.', '' ); $paypal_args['amount_2'] = number_format( $order->get_total_shipping() + $order->get_shipping_tax(), 2, '.', '' );
} }
} else { } else {