Version Description
- 2022-09-07 =
- Add - Filter for manipulating address export data.
- Fix - Remove unnecessary files from plugin zip file.
- Tweak - Transition version numbering to WordPress versioning.
- Tweak - WC 6.7.0 and WP 6.0.1 compatibility.
- Fix - Remove 'translate : true' in package.json.
Download this release
Release Info
Developer | harriswong |
Plugin | WooCommerce ShipStation Gateway |
Version | 4.2.0 |
Comparing to | |
See all releases |
Code changes from version 4.1.49 to 4.2.0
- changelog.txt +5 -1
- includes/api-requests/class-wc-shipstation-api-export.php +57 -28
- readme.txt +7 -3
- woocommerce-shipstation.php +4 -4
changelog.txt
CHANGED
@@ -1,6 +1,10 @@
|
|
1 |
*** ShipStation for WooCommerce ***
|
2 |
|
3 |
-
= 4.
|
|
|
|
|
|
|
|
|
4 |
* Fix - Remove 'translate : true' in package.json.
|
5 |
|
6 |
= 4.1.48 - 2021-11-03 =
|
1 |
*** ShipStation for WooCommerce ***
|
2 |
|
3 |
+
= 4.2.0 - 2022-09-07 =
|
4 |
+
* Add - Filter for manipulating address export data.
|
5 |
+
* Fix - Remove unnecessary files from plugin zip file.
|
6 |
+
* Tweak - Transition version numbering to WordPress versioning.
|
7 |
+
* Tweak - WC 6.8 and WP 6.0 compatibility.
|
8 |
* Fix - Remove 'translate : true' in package.json.
|
9 |
|
10 |
= 4.1.48 - 2021-11-03 =
|
includes/api-requests/class-wc-shipstation-api-export.php
CHANGED
@@ -162,7 +162,7 @@ class WC_Shipstation_API_Export extends WC_Shipstation_API_Request {
|
|
162 |
$this->xml_append( $order_xml, 'CustomField3', apply_filters( 'woocommerce_shipstation_export_custom_field_3_value', get_post_meta( $order_id, $meta_key, true ), $order_id ) );
|
163 |
}
|
164 |
|
165 |
-
// Customer data
|
166 |
$customer_xml = $xml->createElement( 'Customer' );
|
167 |
$this->xml_append( $customer_xml, 'CustomerCode', $wc_gte_30 ? $order->get_billing_email() : $order->billing_email );
|
168 |
|
@@ -173,33 +173,19 @@ class WC_Shipstation_API_Export extends WC_Shipstation_API_Request {
|
|
173 |
$this->xml_append( $billto_xml, 'Email', $wc_gte_30 ? $order->get_billing_email() : $order->billing_email );
|
174 |
$customer_xml->appendChild( $billto_xml );
|
175 |
|
176 |
-
$shipto_xml
|
177 |
-
|
178 |
-
|
179 |
-
$
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
$this->xml_append( $shipto_xml, 'Country', $wc_gte_30 ? $order->get_billing_country() : $order->billing_country );
|
190 |
-
$this->xml_append( $shipto_xml, 'Phone', $wc_gte_30 ? $order->get_billing_phone() : $order->billing_phone );
|
191 |
-
} else {
|
192 |
-
$name = ( $wc_gte_30 ? $order->get_shipping_first_name() : $order->shipping_first_name ) . ' ' . ( $wc_gte_30 ? $order->get_shipping_last_name() : $order->shipping_last_name );
|
193 |
-
$this->xml_append( $shipto_xml, 'Name', $name );
|
194 |
-
$this->xml_append( $shipto_xml, 'Company', $wc_gte_30 ? $order->get_shipping_company() : $order->shipping_company );
|
195 |
-
$this->xml_append( $shipto_xml, 'Address1', $wc_gte_30 ? $order->get_shipping_address_1() : $order->shipping_address_1 );
|
196 |
-
$this->xml_append( $shipto_xml, 'Address2', $wc_gte_30 ? $order->get_shipping_address_2() : $order->shipping_address_2 );
|
197 |
-
$this->xml_append( $shipto_xml, 'City', $wc_gte_30 ? $order->get_shipping_city() : $order->shipping_city );
|
198 |
-
$this->xml_append( $shipto_xml, 'State', $wc_gte_30 ? $order->get_shipping_state() : $order->shipping_state );
|
199 |
-
$this->xml_append( $shipto_xml, 'PostalCode', $wc_gte_30 ? $order->get_shipping_postcode() : $order->shipping_postcode );
|
200 |
-
$this->xml_append( $shipto_xml, 'Country', $wc_gte_30 ? $order->get_shipping_country() : $order->shipping_country );
|
201 |
-
$this->xml_append( $shipto_xml, 'Phone', $wc_gte_30 ? $order->get_billing_phone() : $order->billing_phone );
|
202 |
-
}
|
203 |
$customer_xml->appendChild( $shipto_xml );
|
204 |
|
205 |
$order_xml->appendChild( $customer_xml );
|
@@ -324,6 +310,49 @@ class WC_Shipstation_API_Export extends WC_Shipstation_API_Request {
|
|
324 |
$this->log( sprintf( __( 'Exported %s orders', 'woocommerce-shipstation-integration' ), $exported ) );
|
325 |
}
|
326 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
327 |
/**
|
328 |
* Get shipping method names
|
329 |
* @param WC_Order $order
|
162 |
$this->xml_append( $order_xml, 'CustomField3', apply_filters( 'woocommerce_shipstation_export_custom_field_3_value', get_post_meta( $order_id, $meta_key, true ), $order_id ) );
|
163 |
}
|
164 |
|
165 |
+
// Customer data.
|
166 |
$customer_xml = $xml->createElement( 'Customer' );
|
167 |
$this->xml_append( $customer_xml, 'CustomerCode', $wc_gte_30 ? $order->get_billing_email() : $order->billing_email );
|
168 |
|
173 |
$this->xml_append( $billto_xml, 'Email', $wc_gte_30 ? $order->get_billing_email() : $order->billing_email );
|
174 |
$customer_xml->appendChild( $billto_xml );
|
175 |
|
176 |
+
$shipto_xml = $xml->createElement( 'ShipTo' );
|
177 |
+
$address_data = $this->get_address_data( $order );
|
178 |
+
|
179 |
+
$this->xml_append( $shipto_xml, 'Name', $address_data['name'] );
|
180 |
+
$this->xml_append( $shipto_xml, 'Company', $address_data['company'] );
|
181 |
+
$this->xml_append( $shipto_xml, 'Address1', $address_data['address1'] );
|
182 |
+
$this->xml_append( $shipto_xml, 'Address2', $address_data['address2'] );
|
183 |
+
$this->xml_append( $shipto_xml, 'City', $address_data['city'] );
|
184 |
+
$this->xml_append( $shipto_xml, 'State', $address_data['state'] );
|
185 |
+
$this->xml_append( $shipto_xml, 'PostalCode', $address_data['postcode'] );
|
186 |
+
$this->xml_append( $shipto_xml, 'Country', $address_data['country'] );
|
187 |
+
$this->xml_append( $shipto_xml, 'Phone', $address_data['phone'] );
|
188 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
$customer_xml->appendChild( $shipto_xml );
|
190 |
|
191 |
$order_xml->appendChild( $customer_xml );
|
310 |
$this->log( sprintf( __( 'Exported %s orders', 'woocommerce-shipstation-integration' ), $exported ) );
|
311 |
}
|
312 |
|
313 |
+
/**
|
314 |
+
* Get address data from Order.
|
315 |
+
*
|
316 |
+
* @param WC_Order $order Order object.
|
317 |
+
*
|
318 |
+
* @result array.
|
319 |
+
*/
|
320 |
+
public function get_address_data( $order ) {
|
321 |
+
$wc_gte_30 = version_compare( WC_VERSION, '3.0', '>=' );// gte greater than or equal to 3.0.
|
322 |
+
$shipping_country = $wc_gte_30 ? $order->get_shipping_country() : $order->shipping_country;
|
323 |
+
$shipping_address = $wc_gte_30 ? $order->get_shipping_address_1() : $order->shipping_address_1;
|
324 |
+
|
325 |
+
$address = array();
|
326 |
+
|
327 |
+
if ( empty( $shipping_country ) && empty( $shipping_address ) ) {
|
328 |
+
$name = ( $wc_gte_30 ? $order->get_billing_first_name() : $order->billing_first_name ) . ' ' . ( $wc_gte_30 ? $order->get_billing_last_name() : $order->billing_last_name );
|
329 |
+
|
330 |
+
$address['name'] = $name;
|
331 |
+
$address['company'] = $wc_gte_30 ? $order->get_billing_company() : $order->billing_company;
|
332 |
+
$address['address1'] = $wc_gte_30 ? $order->get_billing_address_1() : $order->billing_address_1;
|
333 |
+
$address['address2'] = $wc_gte_30 ? $order->get_billing_address_2() : $order->billing_address_2;
|
334 |
+
$address['city'] = $wc_gte_30 ? $order->get_billing_city() : $order->billing_city;
|
335 |
+
$address['state'] = $wc_gte_30 ? $order->get_billing_state() : $order->billing_state;
|
336 |
+
$address['postcode'] = $wc_gte_30 ? $order->get_billing_postcode() : $order->billing_postcode;
|
337 |
+
$address['country'] = $wc_gte_30 ? $order->get_billing_country() : $order->billing_country;
|
338 |
+
$address['phone'] = $wc_gte_30 ? $order->get_billing_phone() : $order->billing_phone;
|
339 |
+
} else {
|
340 |
+
$name = ( $wc_gte_30 ? $order->get_shipping_first_name() : $order->shipping_first_name ) . ' ' . ( $wc_gte_30 ? $order->get_shipping_last_name() : $order->shipping_last_name );
|
341 |
+
|
342 |
+
$address['name'] = $name;
|
343 |
+
$address['company'] = $wc_gte_30 ? $order->get_shipping_company() : $order->shipping_company;
|
344 |
+
$address['address1'] = $wc_gte_30 ? $order->get_shipping_address_1() : $order->shipping_address_1;
|
345 |
+
$address['address2'] = $wc_gte_30 ? $order->get_shipping_address_2() : $order->shipping_address_2;
|
346 |
+
$address['city'] = $wc_gte_30 ? $order->get_shipping_city() : $order->shipping_city;
|
347 |
+
$address['state'] = $wc_gte_30 ? $order->get_shipping_state() : $order->shipping_state;
|
348 |
+
$address['postcode'] = $wc_gte_30 ? $order->get_shipping_postcode() : $order->shipping_postcode;
|
349 |
+
$address['country'] = $wc_gte_30 ? $order->get_shipping_country() : $order->shipping_country;
|
350 |
+
$address['phone'] = $wc_gte_30 ? $order->get_billing_phone() : $order->billing_phone;
|
351 |
+
}
|
352 |
+
|
353 |
+
return apply_filters( 'woocommerce_shipstation_export_address_data', $address, $order, $wc_gte_30 );
|
354 |
+
}
|
355 |
+
|
356 |
/**
|
357 |
* Get shipping method names
|
358 |
* @param WC_Order $order
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: shipping, woocommerce, automattic
|
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 5.8
|
6 |
Requires PHP: 5.6
|
7 |
-
Stable tag: 4.
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -46,8 +46,12 @@ If you get stuck, you can ask for help in the Plugin Forum.
|
|
46 |
|
47 |
== Changelog ==
|
48 |
|
49 |
-
= 4.
|
50 |
-
*
|
|
|
|
|
|
|
|
|
51 |
|
52 |
= 4.1.48 - 2021-11-03 =
|
53 |
* Fix - Critical Error when null value is passed to appendChild method.
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 5.8
|
6 |
Requires PHP: 5.6
|
7 |
+
Stable tag: 4.2.0
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
46 |
|
47 |
== Changelog ==
|
48 |
|
49 |
+
= 4.2.0 - 2022-09-07 =
|
50 |
+
* Add - Filter for manipulating address export data.
|
51 |
+
* Fix - Remove unnecessary files from plugin zip file.
|
52 |
+
* Tweak - Transition version numbering to WordPress versioning.
|
53 |
+
* Tweak - WC 6.7.0 and WP 6.0.1 compatibility.
|
54 |
+
* Fix - Remove 'translate : true' in package.json.
|
55 |
|
56 |
= 4.1.48 - 2021-11-03 =
|
57 |
* Fix - Critical Error when null value is passed to appendChild method.
|
woocommerce-shipstation.php
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
/**
|
3 |
* Plugin Name: WooCommerce - ShipStation Integration
|
4 |
* Plugin URI: https://woocommerce.com/products/shipstation-integration/
|
5 |
-
* Version: 4.
|
6 |
* Description: Adds ShipStation label printing support to WooCommerce. Requires server DomDocument support.
|
7 |
* Author: WooCommerce
|
8 |
* Author URI: https://woocommerce.com/
|
9 |
* Text Domain: woocommerce-shipstation-integration
|
10 |
* Domain Path: /languages
|
11 |
-
* Tested up to:
|
12 |
-
* WC tested up to:
|
13 |
* WC requires at least: 3.4
|
14 |
*/
|
15 |
|
@@ -41,7 +41,7 @@ function woocommerce_shipstation_init() {
|
|
41 |
return;
|
42 |
}
|
43 |
|
44 |
-
define( 'WC_SHIPSTATION_VERSION', '4.
|
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.2.0
|
6 |
* Description: Adds ShipStation label printing support to WooCommerce. Requires server DomDocument support.
|
7 |
* Author: WooCommerce
|
8 |
* Author URI: https://woocommerce.com/
|
9 |
* Text Domain: woocommerce-shipstation-integration
|
10 |
* Domain Path: /languages
|
11 |
+
* Tested up to: 6.0
|
12 |
+
* WC tested up to: 6.8
|
13 |
* WC requires at least: 3.4
|
14 |
*/
|
15 |
|
41 |
return;
|
42 |
}
|
43 |
|
44 |
+
define( 'WC_SHIPSTATION_VERSION', '4.2.0' ); // WRCS: DEFINED_VERSION.
|
45 |
define( 'WC_SHIPSTATION_FILE', __FILE__ );
|
46 |
|
47 |
if ( ! defined( 'WC_SHIPSTATION_EXPORT_LIMIT' ) ) {
|