From 3a28c56876d6df3bcfa928bc4ff071c0560f9930 Mon Sep 17 00:00:00 2001 From: claudiosmweb Date: Sun, 20 Jul 2014 00:32:52 -0300 Subject: [PATCH] save and display shipping taxes in order items meta box --- includes/abstracts/abstract-wc-order.php | 4 +++ .../admin/meta-boxes/views/html-order-fee.php | 2 +- .../meta-boxes/views/html-order-item.php | 2 +- .../meta-boxes/views/html-order-shipping.php | 25 ++++++++++++++++--- includes/class-wc-shipping-rate.php | 2 +- 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/includes/abstracts/abstract-wc-order.php b/includes/abstracts/abstract-wc-order.php index b619562f0d1..23aa228923a 100644 --- a/includes/abstracts/abstract-wc-order.php +++ b/includes/abstracts/abstract-wc-order.php @@ -224,6 +224,10 @@ abstract class WC_Abstract_Order { wc_add_order_item_meta( $item_id, 'method_id', $shipping_rate->id ); wc_add_order_item_meta( $item_id, 'cost', wc_format_decimal( $shipping_rate->cost ) ); + // Save shipping taxes - Since 2.2 + $taxes = array_map( 'wc_format_decimal', $shipping_rate->taxes ); + wc_add_order_item_meta( $item_id, 'taxes', $taxes ); + do_action( 'woocommerce_order_add_shipping', $this->id, $item_id, $shipping_rate ); // Update total diff --git a/includes/admin/meta-boxes/views/html-order-fee.php b/includes/admin/meta-boxes/views/html-order-fee.php index c6776279ddc..f7dd3c5a3a5 100644 --- a/includes/admin/meta-boxes/views/html-order-fee.php +++ b/includes/admin/meta-boxes/views/html-order-fee.php @@ -32,7 +32,7 @@ if ( ! defined( 'ABSPATH' ) ) { - + + foreach ( $order_taxes as $tax_item ) : + $tax_item_id = $tax_item['rate_id']; + $tax_item_total = isset( $tax_data[ $tax_item_id ] ) ? $tax_data[ $tax_item_id ] : ''; - + ?> + + +
+ +
+ + + + diff --git a/includes/class-wc-shipping-rate.php b/includes/class-wc-shipping-rate.php index 771083aba49..a7d01a6d379 100644 --- a/includes/class-wc-shipping-rate.php +++ b/includes/class-wc-shipping-rate.php @@ -54,4 +54,4 @@ class WC_Shipping_Rate { } return $taxes; } -} \ No newline at end of file +}