Order Export & Order Import for WooCommerce - Version 1.4.4

Version Description

  • Tested OK with WC 3.6.1 and WP 5.1.1.
  • Bug Fix and Improvements: Tax calculation.
Download this release

Release Info

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

Code changes from version 1.4.3 to 1.4.4

includes/exporter/class-wf-orderimpexpcsv-exporter.php CHANGED
@@ -153,7 +153,8 @@ class WF_OrderImpExpCsv_Exporter {
153
  $line_tax_data = isset($item['line_tax_data']) ? $item['line_tax_data'] : array();
154
  $tax_data = maybe_unserialize($line_tax_data);
155
  $line_item['tax'] = isset($tax_data['total']) ? wc_format_decimal(wc_round_tax_total(array_sum((array) $tax_data['total'])), 2) : '';
156
-
 
157
  $line_items[] = $line_item;
158
  }
159
 
@@ -185,8 +186,11 @@ class WF_OrderImpExpCsv_Exporter {
185
  foreach ($order->get_tax_totals() as $tax_code => $tax) {
186
 
187
  $tax_items[] = implode('|', array(
 
188
  'code:' . $tax_code,
189
  'total:' . wc_format_decimal($tax->amount, 2),
 
 
190
  ));
191
  }
192
 
153
  $line_tax_data = isset($item['line_tax_data']) ? $item['line_tax_data'] : array();
154
  $tax_data = maybe_unserialize($line_tax_data);
155
  $line_item['tax'] = isset($tax_data['total']) ? wc_format_decimal(wc_round_tax_total(array_sum((array) $tax_data['total'])), 2) : '';
156
+ $line_tax_ser = maybe_serialize($line_tax_data);
157
+ $line_item['tax_data'] = $line_tax_ser;
158
  $line_items[] = $line_item;
159
  }
160
 
186
  foreach ($order->get_tax_totals() as $tax_code => $tax) {
187
 
188
  $tax_items[] = implode('|', array(
189
+ 'rate_id:'.$tax->rate_id,
190
  'code:' . $tax_code,
191
  'total:' . wc_format_decimal($tax->amount, 2),
192
+ 'label:'.$tax->label,
193
+ 'tax_rate_compound:'.$tax->is_compound,
194
  ));
195
  }
196
 
includes/importer/class-wf-csv-parser.php CHANGED
@@ -582,6 +582,10 @@ class WF_CSV_Parser {
582
  $qty = substr($qty, strpos($qty, ":") + 1);
583
  $total = array_shift($_item_meta);
584
  $total = substr($total, strpos($total, ":") + 1);
 
 
 
 
585
 
586
 
587
  // find by id
@@ -627,7 +631,7 @@ class WF_CSV_Parser {
627
  $item_meta[$name] = $value;
628
  }
629
 
630
- $order_items[] = array('product_id' => $product_id, 'qty' => $qty, 'total' => $total, 'meta' => $item_meta, 'unknown_product_name' => $unknown_product_name);
631
 
632
  $i++;
633
  }
@@ -663,19 +667,18 @@ 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_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;
673
- while ($tax_item) {
674
 
675
  $tax_item_data = array();
676
 
677
  // turn "label: Tax | tax_amount: 10" into an associative array
678
- foreach (explode('|', $tax_item) as $piece) {
679
  list( $name, $value ) = explode(':', $piece);
680
  $tax_item_data[trim($name)] = trim($value);
681
  }
@@ -739,10 +742,6 @@ class WF_CSV_Parser {
739
  $tax_amount_sum += $tax_item_data['total'];
740
  $shipping_tax_amount_sum += $tax_item_data['shipping_tax_amount'];
741
  }
742
-
743
- // get the next tax item (if any)
744
- $i++;
745
- $tax_item = isset($item['tax_item_' . $i]) ? $item['tax_item_' . $i] : null;
746
  }
747
 
748
  if (!is_numeric($order_tax)) {
582
  $qty = substr($qty, strpos($qty, ":") + 1);
583
  $total = array_shift($_item_meta);
584
  $total = substr($total, strpos($total, ":") + 1);
585
+ $tax = array_shift($_item_meta);
586
+ $tax = substr($tax, strpos($tax, ":") + 1);
587
+ $tax_data = array_shift($_item_meta);
588
+ $tax_data = substr($tax_data, strpos($tax_data, ":") + 1);
589
 
590
 
591
  // find by id
631
  $item_meta[$name] = $value;
632
  }
633
 
634
+ $order_items[] = array('product_id' => $product_id, 'qty' => $qty, 'total' => $total,'tax' => $tax, 'tax_data' => $tax_data, 'meta' => $item_meta, 'unknown_product_name' => $unknown_product_name);
635
 
636
  $i++;
637
  }
667
  $tax_items = array();
668
 
669
  // standard tax item format which supports multiple tax items in numbered columns containing a pipe-delimated, colon-labeled format
670
+ if (!empty($item['tax_items'])) {
671
  // one or more order tax items
672
  // get the first tax item
673
+ $tax_item = explode(';', $item['tax_items']);
674
 
 
675
  $tax_amount_sum = $shipping_tax_amount_sum = 0;
676
+ foreach ($tax_item as $tax) {
677
 
678
  $tax_item_data = array();
679
 
680
  // turn "label: Tax | tax_amount: 10" into an associative array
681
+ foreach (explode('|', $tax) as $piece) {
682
  list( $name, $value ) = explode(':', $piece);
683
  $tax_item_data[trim($name)] = trim($value);
684
  }
742
  $tax_amount_sum += $tax_item_data['total'];
743
  $shipping_tax_amount_sum += $tax_item_data['shipping_tax_amount'];
744
  }
 
 
 
 
745
  }
746
 
747
  if (!is_numeric($order_tax)) {
includes/importer/class-wf-orderimpexpcsv-order-import.php CHANGED
@@ -681,9 +681,10 @@ class WF_OrderImpExpCsv_Order_Import extends WP_Importer {
681
  '_product_id' => $item['product_id'],
682
  '_variation_id' => $var_id,
683
  '_line_subtotal' => number_format((float) $item['total'], 2, '.', ''), // Line subtotal (before discounts)
684
- '_line_subtotal_tax' => 0, // Line tax (before discounts)
685
  '_line_total' => number_format((float) $item['total'], 2, '.', ''), // Line total (after discounts)
686
- '_line_tax' => 0, // Line Tax (after discounts)
 
687
  );
688
 
689
  // add any product variation meta
@@ -741,7 +742,6 @@ class WF_OrderImpExpCsv_Order_Import extends WP_Importer {
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) {
681
  '_product_id' => $item['product_id'],
682
  '_variation_id' => $var_id,
683
  '_line_subtotal' => number_format((float) $item['total'], 2, '.', ''), // Line subtotal (before discounts)
684
+ '_line_subtotal_tax' => number_format((float) $item['tax'], 2, '.', ''), // Line tax (before discounts)
685
  '_line_total' => number_format((float) $item['total'], 2, '.', ''), // Line total (after discounts)
686
+ '_line_tax' => number_format((float) $item['tax'], 2, '.', ''), // Line Tax (after discounts)
687
+ '_line_tax_data' => $item['tax_data'],
688
  );
689
 
690
  // add any product variation meta
742
  wc_add_order_item_meta($tax_order_item_id, 'shipping_tax_amount', $tax_item['shipping_tax_amount']);
743
  }
744
  }
 
745
 
746
  // Grant downloadalbe product permissions
747
  if ($add_download_permissions) {
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.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,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.3");
28
  }
29
 
30
  /**
@@ -75,7 +75,7 @@ if (in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', ge
75
  '<a href="' . admin_url( 'admin.php?page=wf_woocommerce_order_im_ex' ) . '">' . __( 'Import Export', 'order-import-export-for-woocommerce' ) . '</a>',
76
  '<a href="https://www.webtoffee.com/product/woocommerce-order-coupon-subscription-export-import/" target="_blank" style="color:#3db634;">' . __( 'Premium Upgrade', 'order-import-export-for-woocommerce' ) . '</a>',
77
  '<a target="_blank" href="https://www.webtoffee.com/support/">' . __( 'Support', 'order-import-export-for-woocommerce' ) . '</a>',
78
- '<a target="_blank" href="https://wordpress.org/plugins/order-import-export-for-woocommerce/reviews/">' . __('Review', 'wf_customer_import_export') . '</a>',
79
 
80
  );
81
  if (array_key_exists('deactivate', $links)) {
@@ -290,10 +290,10 @@ if (in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', ge
290
 
291
 
292
 
293
- if (!get_option('OCSEIPF_Webtoffee_storefrog_admin_notices_dismissed')) {
294
- add_action('admin_notices', 'webtoffee_storefrog_admin_notices');
295
- add_action('wp_ajax_OCSEIPF_webtoffee_storefrog_notice_dismiss', 'webtoffee_storefrog_notice_dismiss');
296
- }
297
  function webtoffee_storefrog_admin_notices() {
298
 
299
  if (apply_filters('webtoffee_storefrog_suppress_admin_notices', false)) {
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.4
10
  Text Domain: order-import-export-for-woocommerce
11
+ WC tested up to: 3.6.1
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.4");
28
  }
29
 
30
  /**
75
  '<a href="' . admin_url( 'admin.php?page=wf_woocommerce_order_im_ex' ) . '">' . __( 'Import Export', 'order-import-export-for-woocommerce' ) . '</a>',
76
  '<a href="https://www.webtoffee.com/product/woocommerce-order-coupon-subscription-export-import/" target="_blank" style="color:#3db634;">' . __( 'Premium Upgrade', 'order-import-export-for-woocommerce' ) . '</a>',
77
  '<a target="_blank" href="https://www.webtoffee.com/support/">' . __( 'Support', 'order-import-export-for-woocommerce' ) . '</a>',
78
+ '<a target="_blank" href="https://wordpress.org/plugins/order-import-export-for-woocommerce/reviews/">' . __('Review', 'order-import-export-for-woocommerce') . '</a>',
79
 
80
  );
81
  if (array_key_exists('deactivate', $links)) {
290
 
291
 
292
 
293
+ // if (!get_option('OCSEIPF_Webtoffee_storefrog_admin_notices_dismissed')) {
294
+ // add_action('admin_notices', 'webtoffee_storefrog_admin_notices');
295
+ // add_action('wp_ajax_OCSEIPF_webtoffee_storefrog_notice_dismiss', 'webtoffee_storefrog_notice_dismiss');
296
+ // }
297
  function webtoffee_storefrog_admin_notices() {
298
 
299
  if (apply_filters('webtoffee_storefrog_suppress_admin_notices', false)) {
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: webtoffee
3
  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.3
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
  &#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,6 +110,9 @@ Yes. You can import or export order line item details.
110
 
111
  == Changelog ==
112
 
 
 
 
113
  = 1.4.3 =
114
  * Bug fix: Tax calculation.
115
  * WC 3.5.6 compatibility.
@@ -221,6 +224,6 @@ Yes. You can import or export order line item details.
221
  * Export /Import WooCommerce Orders.
222
 
223
  == Upgrade Notice ==
224
- = 1.4.3 =
225
- * Bug fix: Tax calculation.
226
- * WC 3.5.6 compatibility.
3
  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.1
7
+ Stable tag: 1.4.4
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.6.1
25
 
26
  <blockquote>
27
 
110
 
111
  == Changelog ==
112
 
113
+ = 1.4.4 =
114
+ * Tested OK with WC 3.6.1 and WP 5.1.1.
115
+ * Bug Fix and Improvements: Tax calculation.
116
  = 1.4.3 =
117
  * Bug fix: Tax calculation.
118
  * WC 3.5.6 compatibility.
224
  * Export /Import WooCommerce Orders.
225
 
226
  == Upgrade Notice ==
227
+ = 1.4.4 =
228
+ * Tested OK with WC 3.6.1 and WP 5.1.1.
229
+ * Bug Fix and Improvements: Tax calculation.