Version Description
- [Improvement] line item tax import and export.
- Tested OK with WC 4.1.0 and WP 5.4.1
Download this release
Release Info
Developer | webtoffee |
Plugin | Order Export & Order Import for WooCommerce |
Version | 1.6.5 |
Comparing to | |
See all releases |
Code changes from version 1.6.4 to 1.6.5
includes/exporter/class-wf-orderimpexpcsv-exporter.php
CHANGED
@@ -125,25 +125,34 @@ class WF_OrderImpExpCsv_Exporter {
|
|
125 |
'quantity' => $item['qty'],
|
126 |
'total' => wc_format_decimal($order->get_line_total($item), 2),
|
127 |
'sub_total' => wc_format_decimal($order->get_line_subtotal($item), 2),
|
128 |
-
|
129 |
-
//'meta' => html_entity_decode($meta, ENT_NOQUOTES, 'UTF-8'),
|
130 |
-
);
|
131 |
|
132 |
// add line item tax
|
133 |
$line_tax_data = isset($item['line_tax_data']) ? $item['line_tax_data'] : array();
|
134 |
$tax_data = maybe_unserialize($line_tax_data);
|
|
|
135 |
$line_item['tax'] = isset($tax_data['total']) ? wc_format_decimal(wc_round_tax_total(array_sum((array) $tax_data['total'])), 2) : '';
|
136 |
-
$line_tax_ser = maybe_serialize($line_tax_data);
|
137 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
$line_items[] = $line_item;
|
139 |
-
}
|
140 |
-
|
141 |
-
/* foreach ($order->get_shipping_methods() as $_ => $shipping_item) {
|
142 |
-
$shipping_items[] = implode('|', array(
|
143 |
-
'method:' . $shipping_item['name'],
|
144 |
-
'total:' . wc_format_decimal($shipping_item['cost'], 2),
|
145 |
-
));
|
146 |
-
}*/
|
147 |
|
148 |
$line_items_shipping = $order->get_items('shipping');
|
149 |
|
@@ -184,7 +193,7 @@ class WF_OrderImpExpCsv_Exporter {
|
|
184 |
$fee_total += $fee['line_total'];
|
185 |
$fee_tax_total += $fee['line_tax'];
|
186 |
}
|
187 |
-
|
188 |
// get tax items
|
189 |
foreach ($order->get_tax_totals() as $tax_code => $tax) {
|
190 |
$tax_items[] = implode('|', array(
|
125 |
'quantity' => $item['qty'],
|
126 |
'total' => wc_format_decimal($order->get_line_total($item), 2),
|
127 |
'sub_total' => wc_format_decimal($order->get_line_subtotal($item), 2),
|
128 |
+
);
|
|
|
|
|
129 |
|
130 |
// add line item tax
|
131 |
$line_tax_data = isset($item['line_tax_data']) ? $item['line_tax_data'] : array();
|
132 |
$tax_data = maybe_unserialize($line_tax_data);
|
133 |
+
|
134 |
$line_item['tax'] = isset($tax_data['total']) ? wc_format_decimal(wc_round_tax_total(array_sum((array) $tax_data['total'])), 2) : '';
|
135 |
+
$line_tax_ser = maybe_serialize($line_tax_data);
|
136 |
+
foreach ($line_tax_data['total'] as $rate_key => $rate_value) {
|
137 |
+
$tdata = WC_Tax::get_rate_label($rate_key);
|
138 |
+
$line_tax_total_data[] = $tdata."=".$rate_value;
|
139 |
+
}
|
140 |
+
if(!empty($line_tax_total_data)){
|
141 |
+
$line_tax_totat = implode(",", $line_tax_total_data);
|
142 |
+
$line_item['tax_total'] = !empty($line_tax_totat)?$line_tax_totat:'';
|
143 |
+
}
|
144 |
+
|
145 |
+
foreach ($line_tax_data['subtotal'] as $srate_key => $srate_value) {
|
146 |
+
$stdata = WC_Tax::get_rate_label($srate_key);
|
147 |
+
$line_tax_subtotal_data[] = $stdata."=".$srate_value;
|
148 |
+
}
|
149 |
+
if(!empty($line_tax_subtotal_data)){
|
150 |
+
$line_tax_subtotat = implode(",", $line_tax_subtotal_data);
|
151 |
+
$line_item['tax_subtotal'] = !empty($line_tax_subtotat)?$line_tax_subtotat:'';
|
152 |
+
}
|
153 |
+
// $line_item['tax_data'] = $line_tax_ser;
|
154 |
$line_items[] = $line_item;
|
155 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
|
157 |
$line_items_shipping = $order->get_items('shipping');
|
158 |
|
193 |
$fee_total += $fee['line_total'];
|
194 |
$fee_tax_total += $fee['line_tax'];
|
195 |
}
|
196 |
+
add_filter('woocommerce_order_hide_zero_taxes','__return_false');
|
197 |
// get tax items
|
198 |
foreach ($order->get_tax_totals() as $tax_code => $tax) {
|
199 |
$tax_items[] = implode('|', array(
|
includes/importer/class-wf-cpnimpexpcsv-coupon-import.php
CHANGED
File without changes
|
includes/importer/class-wf-csv-parser.php
CHANGED
@@ -505,6 +505,35 @@ class WF_CSV_Parser {
|
|
505 |
if ($item['line_item_' . $i] && empty($_item_meta)) {
|
506 |
$_item_meta = explode('|', $item['line_item_' . $i]);
|
507 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
508 |
$name = array_shift($_item_meta);
|
509 |
$name = substr($name, strpos($name, ":") + 1);
|
510 |
$unknown_product_name = $name;
|
@@ -519,7 +548,7 @@ class WF_CSV_Parser {
|
|
519 |
$tax = array_shift($_item_meta);
|
520 |
$tax = substr($tax, strpos($tax, ":") + 1);
|
521 |
$tax_data = array_shift($_item_meta);
|
522 |
-
$tax_data =
|
523 |
// find by id
|
524 |
if (false !== strpos($product_identifier_by_id, 'product_id:')) {
|
525 |
// product by product_id
|
505 |
if ($item['line_item_' . $i] && empty($_item_meta)) {
|
506 |
$_item_meta = explode('|', $item['line_item_' . $i]);
|
507 |
}
|
508 |
+
|
509 |
+
$all_tax_data = array();
|
510 |
+
foreach ($_item_meta as $item_key => $item_value) {
|
511 |
+
|
512 |
+
$data_exploded = explode(":", $item_value);
|
513 |
+
if($data_exploded[0] == 'tax_total' && isset($data_exploded[1])&&!empty($data_exploded[1])){
|
514 |
+
$item_taxs = explode(",", $data_exploded[1]);
|
515 |
+
$tax_arr = array();
|
516 |
+
foreach ($item_taxs as $tax_key => $tax_value) {
|
517 |
+
$tax_details = explode("=", $tax_value);
|
518 |
+
$rate_id = $wpdb->get_var( $wpdb->prepare( "SELECT tax_rate_id FROM {$wpdb->prefix}woocommerce_tax_rates WHERE tax_rate_name = %s", $tax_details[0] ) );
|
519 |
+
$tax_arr[intval($rate_id)] = $tax_details[1];
|
520 |
+
}
|
521 |
+
$all_tax_data['total'] = $tax_arr;
|
522 |
+
unset($_item_meta[$item_key]);
|
523 |
+
}
|
524 |
+
if($data_exploded[0] == 'tax_subtotal'&& isset($data_exploded[1])&&!empty($data_exploded[1])){
|
525 |
+
$tax_arr = array();
|
526 |
+
$item_taxs_subtotal = explode(",", $data_exploded[1]);
|
527 |
+
foreach ($item_taxs_subtotal as $tax_stkey => $tax_stvalue) {
|
528 |
+
$st_tax_details = explode("=", $tax_stvalue);
|
529 |
+
$rate_id = $wpdb->get_var( $wpdb->prepare( "SELECT tax_rate_id FROM {$wpdb->prefix}woocommerce_tax_rates WHERE tax_rate_name = %s", $st_tax_details[0] ) );
|
530 |
+
$tax_arr[intval($rate_id)] = $st_tax_details[1];
|
531 |
+
}
|
532 |
+
$all_tax_data['subtotal'] = $tax_arr;
|
533 |
+
unset($_item_meta[$item_key]);
|
534 |
+
}
|
535 |
+
|
536 |
+
}
|
537 |
$name = array_shift($_item_meta);
|
538 |
$name = substr($name, strpos($name, ":") + 1);
|
539 |
$unknown_product_name = $name;
|
548 |
$tax = array_shift($_item_meta);
|
549 |
$tax = substr($tax, strpos($tax, ":") + 1);
|
550 |
$tax_data = array_shift($_item_meta);
|
551 |
+
$tax_data = $all_tax_data;
|
552 |
// find by id
|
553 |
if (false !== strpos($product_identifier_by_id, 'product_id:')) {
|
554 |
// product by product_id
|
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.6.
|
10 |
Text Domain: order-import-export-for-woocommerce
|
11 |
-
WC tested up to: 4.0
|
12 |
License: GPLv3
|
13 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
14 |
*/
|
@@ -24,13 +24,13 @@ 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.6.
|
28 |
}
|
29 |
|
30 |
/**
|
31 |
* Check if WooCommerce is active
|
32 |
*/
|
33 |
-
if ( ! in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))) && !array_key_exists('woocommerce/woocommerce.php', apply_filters('active_plugins', get_site_option('active_sitewide_plugins')))) { // deactive if woocommerce in not active
|
34 |
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
35 |
deactivate_plugins( plugin_basename(__FILE__) );
|
36 |
}
|
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.6.5
|
10 |
Text Domain: order-import-export-for-woocommerce
|
11 |
+
WC tested up to: 4.1.0
|
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.6.5");
|
28 |
}
|
29 |
|
30 |
/**
|
31 |
* Check if WooCommerce is active
|
32 |
*/
|
33 |
+
if ( ! in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))) && !array_key_exists( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_site_option( 'active_sitewide_plugins', array() ) ) ) ) { // deactive if woocommerce in not active
|
34 |
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
35 |
deactivate_plugins( plugin_basename(__FILE__) );
|
36 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,8 @@ Donate link: https://www.webtoffee.com/plugins/
|
|
4 |
Tags: order export, order import, woocommerce export orders, woocommerce import orders, export orders, import orders, order, export, import, woocommerce, csv, coupon, coupon export, coupon import, woocommerce export coupon , woocommerce import coupon , export coupons, import coupons, woocommerce coupon generator
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 5.4
|
7 |
-
|
|
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -21,7 +22,7 @@ This is a perfect tool if you are migrating an existing shop on a different eCom
|
|
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 4.0
|
25 |
🔸 Tested OK with PHP 7.3.5
|
26 |
|
27 |
<blockquote>
|
@@ -117,6 +118,9 @@ By default, admin and store manager are given access to export orders from your
|
|
117 |
|
118 |
== Changelog ==
|
119 |
|
|
|
|
|
|
|
120 |
= 1.6.4 =
|
121 |
* Bug Fix:- Problem with activating plugin in multisite.
|
122 |
= 1.6.3 =
|
@@ -288,3 +292,7 @@ By default, admin and store manager are given access to export orders from your
|
|
288 |
* Export /Import WooCommerce Orders.
|
289 |
|
290 |
== Upgrade Notice ==
|
|
|
|
|
|
|
|
4 |
Tags: order export, order import, woocommerce export orders, woocommerce import orders, export orders, import orders, order, export, import, woocommerce, csv, coupon, coupon export, coupon import, woocommerce export coupon , woocommerce import coupon , export coupons, import coupons, woocommerce coupon generator
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 5.4
|
7 |
+
Requires PHP: 5.6
|
8 |
+
Stable tag: 1.6.5
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
22 |
🔸 Import Coupons from CSV file.
|
23 |
🔸 Export Subscription Orders to CSV file(Premium Feature).
|
24 |
🔸 Import Subscription Orders from CSV file(Premium Feature).
|
25 |
+
🔸 Tested OK with WooCommerce 4.1.0
|
26 |
🔸 Tested OK with PHP 7.3.5
|
27 |
|
28 |
<blockquote>
|
118 |
|
119 |
== Changelog ==
|
120 |
|
121 |
+
= 1.6.5 =
|
122 |
+
* [Improvement] line item tax import and export.
|
123 |
+
* Tested OK with WC 4.1.0 and WP 5.4.1
|
124 |
= 1.6.4 =
|
125 |
* Bug Fix:- Problem with activating plugin in multisite.
|
126 |
= 1.6.3 =
|
292 |
* Export /Import WooCommerce Orders.
|
293 |
|
294 |
== Upgrade Notice ==
|
295 |
+
|
296 |
+
= 1.6.5 =
|
297 |
+
* [Improvement] line item tax import and export.
|
298 |
+
* Tested OK with WC 4.1.0 and WP 5.4.1
|