Order Export & Order Import for WooCommerce - Version 1.4.3

Version Description

  • Bug fix: Tax calculation.
  • WC 3.5.6 compatibility.
Download this release

Release Info

Developer webtoffee
Plugin Icon 128x128 Order Export & Order Import for WooCommerce
Version 1.4.3
Comparing to
See all releases

Code changes from version 1.4.2 to 1.4.3

includes/exporter/class-wf-orderimpexpcsv-exporter.php CHANGED
@@ -145,7 +145,7 @@ class WF_OrderImpExpCsv_Exporter {
145
  'sku' => $product->get_sku(),
146
  'quantity' => $item['qty'],
147
  'total' => wc_format_decimal($order->get_line_total($item), 2),
148
- 'refunded' => wc_format_decimal($order->get_total_refunded_for_item($item_id), 2),
149
  //'meta' => html_entity_decode($meta, ENT_NOQUOTES, 'UTF-8'),
150
  );
151
 
145
  'sku' => $product->get_sku(),
146
  'quantity' => $item['qty'],
147
  'total' => wc_format_decimal($order->get_line_total($item), 2),
148
+ // 'refunded' => wc_format_decimal($order->get_total_refunded_for_item($item_id), 2),
149
  //'meta' => html_entity_decode($meta, ENT_NOQUOTES, 'UTF-8'),
150
  );
151
 
includes/importer/class-wf-csv-parser.php CHANGED
@@ -663,10 +663,10 @@ class WF_CSV_Parser {
663
  $tax_items = array();
664
 
665
  // standard tax item format which supports multiple tax items in numbered columns containing a pipe-delimated, colon-labeled format
666
- if (!empty($item['tax_item_1']) || !empty($item['tax_item'])) {
667
  // one or more order tax items
668
  // get the first tax item
669
- $tax_item = !empty($item['tax_item_1']) ? $item['tax_item_1'] : $item['tax_item'];
670
 
671
  $i = 1;
672
  $tax_amount_sum = $shipping_tax_amount_sum = 0;
@@ -686,7 +686,7 @@ class WF_CSV_Parser {
686
  }
687
 
688
  // have a tax amount or shipping tax amount
689
- if (isset($tax_item_data['tax_amount']) || isset($tax_item_data['shipping_tax_amount'])) {
690
 
691
  // try and look up rate id by label if needed
692
  if (isset($tax_item_data['label']) && $tax_item_data['label'] && !$tax_item_data['rate_id']) {
@@ -711,8 +711,8 @@ class WF_CSV_Parser {
711
  }
712
 
713
  // default tax amounts to 0 if not set
714
- if (!isset($tax_item_data['tax_amount'])) {
715
- $tax_item_data['tax_amount'] = 0;
716
  }
717
  if (!isset($tax_item_data['shipping_tax_amount'])) {
718
  $tax_item_data['shipping_tax_amount'] = 0;
@@ -727,16 +727,16 @@ class WF_CSV_Parser {
727
  }
728
 
729
  $tax_items[] = array(
730
- 'title' => '',
731
  'rate_id' => $tax_item_data['rate_id'],
732
  'label' => $tax_item_data['label'],
733
  'compound' => $tax_item_data['tax_rate_compound'],
734
- 'tax_amount' => $tax_item_data['tax_amount'],
735
  'shipping_tax_amount' => $tax_item_data['shipping_tax_amount'],
736
  );
737
 
738
  // sum up the order totals, in case it wasn't part of the import
739
- $tax_amount_sum += $tax_item_data['tax_amount'];
740
  $shipping_tax_amount_sum += $tax_item_data['shipping_tax_amount'];
741
  }
742
 
@@ -760,7 +760,6 @@ class WF_CSV_Parser {
760
  if (!is_numeric($order_shipping_tax)) {
761
  $order_shipping_tax = 0;
762
  }
763
-
764
  // no tax items specified, so create a default one using the tax totals
765
  if (0 == count($tax_items)) {
766
 
@@ -778,7 +777,6 @@ class WF_CSV_Parser {
778
  $postmeta[] = array('key' => '_order_tax', 'value' => number_format((float) $order_tax, 2, '.', ''));
779
  $postmeta[] = array('key' => '_order_shipping_tax', 'value' => number_format((float) $order_shipping_tax, 2, '.', ''));
780
 
781
-
782
  if ($order) {
783
  $order['postmeta'] = $postmeta;
784
  $order['order_items'] = $order_items;
663
  $tax_items = array();
664
 
665
  // standard tax item format which supports multiple tax items in numbered columns containing a pipe-delimated, colon-labeled format
666
+ if (!empty($item['tax_item_1']) || !empty($item['tax_items'])) {
667
  // one or more order tax items
668
  // get the first tax item
669
+ $tax_item = !empty($item['tax_item_1']) ? $item['tax_item_1'] : $item['tax_items'];
670
 
671
  $i = 1;
672
  $tax_amount_sum = $shipping_tax_amount_sum = 0;
686
  }
687
 
688
  // have a tax amount or shipping tax amount
689
+ if (isset($tax_item_data['total']) || isset($tax_item_data['shipping_tax_amount'])) {
690
 
691
  // try and look up rate id by label if needed
692
  if (isset($tax_item_data['label']) && $tax_item_data['label'] && !$tax_item_data['rate_id']) {
711
  }
712
 
713
  // default tax amounts to 0 if not set
714
+ if (!isset($tax_item_data['total'])) {
715
+ $tax_item_data['total'] = 0;
716
  }
717
  if (!isset($tax_item_data['shipping_tax_amount'])) {
718
  $tax_item_data['shipping_tax_amount'] = 0;
727
  }
728
 
729
  $tax_items[] = array(
730
+ 'title' => $tax_item_data['code'],
731
  'rate_id' => $tax_item_data['rate_id'],
732
  'label' => $tax_item_data['label'],
733
  'compound' => $tax_item_data['tax_rate_compound'],
734
+ 'tax_amount' => $tax_item_data['total'],
735
  'shipping_tax_amount' => $tax_item_data['shipping_tax_amount'],
736
  );
737
 
738
  // sum up the order totals, in case it wasn't part of the import
739
+ $tax_amount_sum += $tax_item_data['total'];
740
  $shipping_tax_amount_sum += $tax_item_data['shipping_tax_amount'];
741
  }
742
 
760
  if (!is_numeric($order_shipping_tax)) {
761
  $order_shipping_tax = 0;
762
  }
 
763
  // no tax items specified, so create a default one using the tax totals
764
  if (0 == count($tax_items)) {
765
 
777
  $postmeta[] = array('key' => '_order_tax', 'value' => number_format((float) $order_tax, 2, '.', ''));
778
  $postmeta[] = array('key' => '_order_shipping_tax', 'value' => number_format((float) $order_shipping_tax, 2, '.', ''));
779
 
 
780
  if ($order) {
781
  $order['postmeta'] = $postmeta;
782
  $order['order_items'] = $order_items;
includes/importer/class-wf-orderimpexpcsv-order-import.php CHANGED
@@ -638,6 +638,7 @@ class WF_OrderImpExpCsv_Order_Import extends WP_Importer {
638
  $wpdb->query( $wpdb->prepare( "DELETE FROM itemmeta USING {$wpdb->prefix}woocommerce_order_itemmeta itemmeta INNER JOIN {$wpdb->prefix}woocommerce_order_items items WHERE itemmeta.order_item_id = items.order_item_id and items.order_id = %d and items.order_item_type != %s", $order_id ,$coup_str) );
639
  $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}woocommerce_order_items WHERE order_id = %d and order_item_type != %s", $order_id ,$coup_str) );
640
  }
 
641
 
642
  // handle order items
643
  $order_items = array();
@@ -721,7 +722,7 @@ class WF_OrderImpExpCsv_Order_Import extends WP_Importer {
721
  wc_add_order_item_meta($shipping_order_item_id, 'cost', $order_shipping['cost']);
722
  }
723
  }
724
-
725
  // create the tax order items
726
  foreach ($post['tax_items'] as $tax_item) {
727
 
@@ -740,6 +741,7 @@ class WF_OrderImpExpCsv_Order_Import extends WP_Importer {
740
  wc_add_order_item_meta($tax_order_item_id, 'shipping_tax_amount', $tax_item['shipping_tax_amount']);
741
  }
742
  }
 
743
 
744
  // Grant downloadalbe product permissions
745
  if ($add_download_permissions) {
@@ -752,7 +754,6 @@ class WF_OrderImpExpCsv_Order_Import extends WP_Importer {
752
  if ($merging && $is_order_exist) {
753
  $wpdb->query($wpdb->prepare("DELETE comments,meta FROM {$wpdb->prefix}comments comments LEFT JOIN {$wpdb->prefix}commentmeta meta ON comments.comment_ID = meta.comment_id WHERE comments.comment_post_ID = %d",$order_id));
754
  }
755
- $order = wc_get_order($order_id);
756
  foreach ($post['notes'] as $order_note) {
757
  $note = explode('|', $order_note);
758
  $con = array_shift($note);
638
  $wpdb->query( $wpdb->prepare( "DELETE FROM itemmeta USING {$wpdb->prefix}woocommerce_order_itemmeta itemmeta INNER JOIN {$wpdb->prefix}woocommerce_order_items items WHERE itemmeta.order_item_id = items.order_item_id and items.order_id = %d and items.order_item_type != %s", $order_id ,$coup_str) );
639
  $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}woocommerce_order_items WHERE order_id = %d and order_item_type != %s", $order_id ,$coup_str) );
640
  }
641
+ $order = wc_get_order($order_id);
642
 
643
  // handle order items
644
  $order_items = array();
722
  wc_add_order_item_meta($shipping_order_item_id, 'cost', $order_shipping['cost']);
723
  }
724
  }
725
+
726
  // create the tax order items
727
  foreach ($post['tax_items'] as $tax_item) {
728
 
741
  wc_add_order_item_meta($tax_order_item_id, 'shipping_tax_amount', $tax_item['shipping_tax_amount']);
742
  }
743
  }
744
+ $order->calculate_taxes();
745
 
746
  // Grant downloadalbe product permissions
747
  if ($add_download_permissions) {
754
  if ($merging && $is_order_exist) {
755
  $wpdb->query($wpdb->prepare("DELETE comments,meta FROM {$wpdb->prefix}comments comments LEFT JOIN {$wpdb->prefix}commentmeta meta ON comments.comment_ID = meta.comment_id WHERE comments.comment_post_ID = %d",$order_id));
756
  }
 
757
  foreach ($post['notes'] as $order_note) {
758
  $note = explode('|', $order_note);
759
  $con = array_shift($note);
order-import-export-for-woocommerce.php CHANGED
@@ -6,9 +6,9 @@ Plugin URI: https://wordpress.org/plugins/order-import-export-for-woocommerce/
6
  Description: Export and Import Order detail including line items, From and To your WooCommerce Store.
7
  Author: WebToffee
8
  Author URI: https://www.webtoffee.com/product/woocommerce-order-coupon-subscription-export-import/
9
- Version: 1.4.2
10
  Text Domain: order-import-export-for-woocommerce
11
- WC tested up to: 3.5.5
12
  License: GPLv3
13
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
14
  */
@@ -24,7 +24,7 @@ define("WF_CPN_IMP_EXP_ID", "wf_cpn_imp_exp");
24
  define("wf_coupon_csv_im_ex", "wf_coupon_csv_im_ex");
25
 
26
  if (!defined('WF_ORDERIMPEXP_CURRENT_VERSION')) {
27
- define("WF_ORDERIMPEXP_CURRENT_VERSION", "1.4.2");
28
  }
29
 
30
  /**
6
  Description: Export and Import Order detail including line items, From and To your WooCommerce Store.
7
  Author: WebToffee
8
  Author URI: https://www.webtoffee.com/product/woocommerce-order-coupon-subscription-export-import/
9
+ Version: 1.4.3
10
  Text Domain: order-import-export-for-woocommerce
11
+ WC tested up to: 3.5.6
12
  License: GPLv3
13
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
14
  */
24
  define("wf_coupon_csv_im_ex", "wf_coupon_csv_im_ex");
25
 
26
  if (!defined('WF_ORDERIMPEXP_CURRENT_VERSION')) {
27
+ define("WF_ORDERIMPEXP_CURRENT_VERSION", "1.4.3");
28
  }
29
 
30
  /**
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.webtoffee.com/plugins/
4
  Tags: Order Export, Order Import, WooCommerce Export Orders , WooCommerce Import Orders , Export Orders, Import Orders
5
  Requires at least: 3.0.1
6
  Tested up to: 5.1
7
- Stable tag: 1.4.2
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -21,7 +21,7 @@ This is perfect tool if you are migrating an existing shop on a different eComme
21
  🔸 Import Coupons from CSV file.
22
  🔸 Export Subscription Orders to CSV file(Premium Feature).
23
  🔸 Import Subscription Orders from CSV file(Premium Feature).
24
- 🔸 Tested OK with WooCommerce 3.5.5
25
 
26
  <blockquote>
27
 
@@ -110,6 +110,9 @@ Yes. You can import or export order line item details.
110
 
111
  == Changelog ==
112
 
 
 
 
113
  = 1.4.2 =
114
  * Bug fix.
115
  * WC 3.5.5 and WP5.1 compatibility.
@@ -218,6 +221,6 @@ Yes. You can import or export order line item details.
218
  * Export /Import WooCommerce Orders.
219
 
220
  == Upgrade Notice ==
221
- = 1.4.2 =
222
- * Bug fix.
223
- * WC 3.5.5 and WP5.1 compatibility.
4
  Tags: Order Export, Order Import, WooCommerce Export Orders , WooCommerce Import Orders , Export Orders, Import Orders
5
  Requires at least: 3.0.1
6
  Tested up to: 5.1
7
+ Stable tag: 1.4.3
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
21
  &#128312; Import Coupons from CSV file.
22
  &#128312; Export Subscription Orders to CSV file(Premium Feature).
23
  &#128312; Import Subscription Orders from CSV file(Premium Feature).
24
+ &#128312; Tested OK with WooCommerce 3.5.6
25
 
26
  <blockquote>
27
 
110
 
111
  == Changelog ==
112
 
113
+ = 1.4.3 =
114
+ * Bug fix: Tax calculation.
115
+ * WC 3.5.6 compatibility.
116
  = 1.4.2 =
117
  * Bug fix.
118
  * WC 3.5.5 and WP5.1 compatibility.
221
  * Export /Import WooCommerce Orders.
222
 
223
  == Upgrade Notice ==
224
+ = 1.4.3 =
225
+ * Bug fix: Tax calculation.
226
+ * WC 3.5.6 compatibility.