WooCommerce ShipStation Gateway - Version 4.1.41

Version Description

  • 2021-03-02 =
  • Add - Add currency code and weight units to orders XML.
Download this release

Release Info

Developer frosso1
Plugin Icon 128x128 WooCommerce ShipStation Gateway
Version 4.1.41
Comparing to
See all releases

Code changes from version 4.1.40 to 4.1.41

changelog.txt CHANGED
@@ -1,5 +1,8 @@
1
  *** ShipStation for WooCommerce ***
2
 
 
 
 
3
  = 4.1.40 - 2020-11-24 =
4
  * Tweak - PHP 8 compatibility fixes.
5
 
1
  *** ShipStation for WooCommerce ***
2
 
3
+ = 4.1.41 - 2021-03-02 =
4
+ * Add - Add currency code and weight units to orders XML.
5
+
6
  = 4.1.40 - 2020-11-24 =
7
  * Tweak - PHP 8 compatibility fixes.
8
 
includes/api-requests/class-wc-shipstation-api-export.php CHANGED
@@ -34,6 +34,7 @@ class WC_Shipstation_API_Export extends WC_Shipstation_API_Request {
34
  $tz_offset = get_option( 'gmt_offset' ) * 3600;
35
  $raw_start_date = wc_clean( urldecode( $_GET['start_date'] ) );
36
  $raw_end_date = wc_clean( urldecode( $_GET['end_date'] ) );
 
37
 
38
  // Parse start and end date
39
  if ( $raw_start_date && false === strtotime( $raw_start_date ) ) {
@@ -134,6 +135,7 @@ class WC_Shipstation_API_Export extends WC_Shipstation_API_Request {
134
  $this->xml_append( $order_xml, 'LastModified', gmdate( 'm/d/Y H:i', $last_modified ), false );
135
  $this->xml_append( $order_xml, 'ShippingMethod', implode( ' | ', $this->get_shipping_methods( $order ) ) );
136
 
 
137
  $this->xml_append( $order_xml, 'OrderTotal', $order->get_total(), false );
138
  $this->xml_append( $order_xml, 'TaxAmount', wc_round_tax_total( $order->get_total_tax() ), false );
139
 
@@ -237,8 +239,14 @@ class WC_Shipstation_API_Export extends WC_Shipstation_API_Request {
237
  $image_url = $image_id ? current( wp_get_attachment_image_src( $image_id, 'woocommerce_gallery_thumbnail' ) ) : '';
238
  $this->xml_append( $item_xml, 'ImageUrl', $image_url );
239
 
240
- $this->xml_append( $item_xml, 'Weight', wc_get_weight( $product->get_weight(), 'oz' ), false );
241
- $this->xml_append( $item_xml, 'WeightUnits', 'Ounces', false );
 
 
 
 
 
 
242
  $this->xml_append( $item_xml, 'Quantity', $item['qty'], false );
243
  $this->xml_append( $item_xml, 'UnitPrice', $order->get_item_subtotal( $item, false, true ), false );
244
  }
@@ -371,6 +379,22 @@ class WC_Shipstation_API_Export extends WC_Shipstation_API_Request {
371
  $data->appendChild( $append_to->ownerDocument->createTextNode( $value ) );
372
  }
373
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
374
  }
375
 
376
  return new WC_Shipstation_API_Export();
34
  $tz_offset = get_option( 'gmt_offset' ) * 3600;
35
  $raw_start_date = wc_clean( urldecode( $_GET['start_date'] ) );
36
  $raw_end_date = wc_clean( urldecode( $_GET['end_date'] ) );
37
+ $store_weight_unit = get_option('woocommerce_weight_unit');
38
 
39
  // Parse start and end date
40
  if ( $raw_start_date && false === strtotime( $raw_start_date ) ) {
135
  $this->xml_append( $order_xml, 'LastModified', gmdate( 'm/d/Y H:i', $last_modified ), false );
136
  $this->xml_append( $order_xml, 'ShippingMethod', implode( ' | ', $this->get_shipping_methods( $order ) ) );
137
 
138
+ $this->xml_append( $order_xml, 'CurrencyCode', get_woocommerce_currency(), false );
139
  $this->xml_append( $order_xml, 'OrderTotal', $order->get_total(), false );
140
  $this->xml_append( $order_xml, 'TaxAmount', wc_round_tax_total( $order->get_total_tax() ), false );
141
 
239
  $image_url = $image_id ? current( wp_get_attachment_image_src( $image_id, 'woocommerce_gallery_thumbnail' ) ) : '';
240
  $this->xml_append( $item_xml, 'ImageUrl', $image_url );
241
 
242
+ if ( 'kg' === $store_weight_unit ) {
243
+ $this->xml_append( $item_xml, 'Weight', wc_get_weight( $product->get_weight(), 'g' ), false );
244
+ $this->xml_append( $item_xml, 'WeightUnits', 'Grams', false );
245
+ } else {
246
+ $this->xml_append( $item_xml, 'Weight', $product->get_weight(), false );
247
+ $this->xml_append( $item_xml, 'WeightUnits', $this->get_shipstation_weight_units( $store_weight_unit ), false );
248
+ }
249
+
250
  $this->xml_append( $item_xml, 'Quantity', $item['qty'], false );
251
  $this->xml_append( $item_xml, 'UnitPrice', $order->get_item_subtotal( $item, false, true ), false );
252
  }
379
  $data->appendChild( $append_to->ownerDocument->createTextNode( $value ) );
380
  }
381
  }
382
+
383
+ /**
384
+ * Convert weight unit abbreviation to Shipstation enum (Pounds, Ounces, Grams)
385
+ */
386
+ private function get_shipstation_weight_units( $unit_abbreviation ) {
387
+ switch( $unit_abbreviation ) {
388
+ case 'lbs':
389
+ return 'Pounds';
390
+ case 'oz':
391
+ return 'Ounces';
392
+ case 'g':
393
+ return 'Grams';
394
+ default:
395
+ return $unit_abbreviation;
396
+ }
397
+ }
398
  }
399
 
400
  return new WC_Shipstation_API_Export();
languages/woocommerce-shipstation.pot CHANGED
@@ -1,28 +1,28 @@
1
- # Copyright (C) 2020 WooCommerce
2
  # This file is distributed under the same license as the WooCommerce - ShipStation Integration package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce - ShipStation Integration 4.1.40\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-shipstation\n"
8
- "POT-Creation-Date: 2020-11-24 19:36:40+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "PO-Revision-Date: 2020-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
  "X-Generator: node-wp-i18n 1.2.3\n"
16
 
17
- #: includes/api-requests/class-wc-shipstation-api-export.php:287
18
  msgid "Total Discount"
19
  msgstr ""
20
 
21
- #: includes/api-requests/class-wc-shipstation-api-export.php:302
22
  msgid "Order has been exported to Shipstation"
23
  msgstr ""
24
 
25
- #: includes/api-requests/class-wc-shipstation-api-export.php:313
26
  #. translators: 1: total count
27
  msgid "Exported %s orders"
28
  msgstr ""
1
+ # Copyright (C) 2021 WooCommerce
2
  # This file is distributed under the same license as the WooCommerce - ShipStation Integration package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce - ShipStation Integration 4.1.41\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-shipstation\n"
8
+ "POT-Creation-Date: 2021-03-02 15:16:08+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "PO-Revision-Date: 2021-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
  "X-Generator: node-wp-i18n 1.2.3\n"
16
 
17
+ #: includes/api-requests/class-wc-shipstation-api-export.php:295
18
  msgid "Total Discount"
19
  msgstr ""
20
 
21
+ #: includes/api-requests/class-wc-shipstation-api-export.php:310
22
  msgid "Order has been exported to Shipstation"
23
  msgstr ""
24
 
25
+ #: includes/api-requests/class-wc-shipstation-api-export.php:321
26
  #. translators: 1: total count
27
  msgid "Exported %s orders"
28
  msgstr ""
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: shipping, woocommerce, automattic
4
  Requires at least: 4.4
5
  Tested up to: 5.5
6
  Requires PHP: 5.6
7
- Stable tag: 4.1.40
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -46,6 +46,9 @@ If you get stuck, you can ask for help in the Plugin Forum.
46
 
47
  == Changelog ==
48
 
 
 
 
49
  = 4.1.40 - 2020-11-24 =
50
  * Tweak - PHP 8 compatibility fixes.
51
 
4
  Requires at least: 4.4
5
  Tested up to: 5.5
6
  Requires PHP: 5.6
7
+ Stable tag: 4.1.41
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
46
 
47
  == Changelog ==
48
 
49
+ = 4.1.41 - 2021-03-02 =
50
+ * Add - Add currency code and weight units to orders XML.
51
+
52
  = 4.1.40 - 2020-11-24 =
53
  * Tweak - PHP 8 compatibility fixes.
54
 
woocommerce-shipstation.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: WooCommerce - ShipStation Integration
4
  * Plugin URI: https://woocommerce.com/products/shipstation-integration/
5
- * Version: 4.1.40
6
  * Description: Adds ShipStation label printing support to WooCommerce. Requires server DomDocument support.
7
  * Author: WooCommerce
8
  * Author URI: https://woocommerce.com/
@@ -41,7 +41,7 @@ function woocommerce_shipstation_init() {
41
  return;
42
  }
43
 
44
- define( 'WC_SHIPSTATION_VERSION', '4.1.40' ); // WRCS: DEFINED_VERSION.
45
  define( 'WC_SHIPSTATION_FILE', __FILE__ );
46
 
47
  if ( ! defined( 'WC_SHIPSTATION_EXPORT_LIMIT' ) ) {
2
  /**
3
  * Plugin Name: WooCommerce - ShipStation Integration
4
  * Plugin URI: https://woocommerce.com/products/shipstation-integration/
5
+ * Version: 4.1.41
6
  * Description: Adds ShipStation label printing support to WooCommerce. Requires server DomDocument support.
7
  * Author: WooCommerce
8
  * Author URI: https://woocommerce.com/
41
  return;
42
  }
43
 
44
+ define( 'WC_SHIPSTATION_VERSION', '4.1.41' ); // WRCS: DEFINED_VERSION.
45
  define( 'WC_SHIPSTATION_FILE', __FILE__ );
46
 
47
  if ( ! defined( 'WC_SHIPSTATION_EXPORT_LIMIT' ) ) {