WooCommerce Services - Version 1.3.2

Version Description

  • Hide destination address normalized order meta
  • Log rate retrieval failures as errors with admin notice
Download this release

Release Info

Developer woothemes
Plugin Icon 128x128 WooCommerce Services
Version 1.3.2
Comparing to
See all releases

Code changes from version 1.3.1 to 1.3.2

classes/class-wc-connect-service-settings-store.php CHANGED
@@ -138,7 +138,7 @@ if ( ! class_exists( 'WC_Connect_Service_Settings_Store' ) ) {
138
  unset( $new_address[ 'address' ], $new_address[ 'name' ] );
139
 
140
  $order->set_address( $new_address, 'shipping' );
141
- update_post_meta( $order->id, 'wc_connect_destination_normalized', true );
142
  }
143
 
144
  protected function sort_services( $a, $b ) {
138
  unset( $new_address[ 'address' ], $new_address[ 'name' ] );
139
 
140
  $order->set_address( $new_address, 'shipping' );
141
+ update_post_meta( $order->id, '_wc_connect_destination_normalized', true );
142
  }
143
 
144
  protected function sort_services( $a, $b ) {
classes/class-wc-connect-shipping-label.php CHANGED
@@ -242,7 +242,7 @@ if ( ! class_exists( 'WC_Connect_Shipping_Label' ) ) {
242
  $destination[ 'country' ] = $origin[ 'country' ];
243
  }
244
 
245
- $destination_normalized = ( bool ) get_post_meta( $order->id, 'wc_connect_destination_normalized', true );
246
 
247
  $form_data = compact( 'is_packed', 'selected_packages', 'all_packages', 'flat_rate_groups', 'origin', 'destination', 'destination_normalized' );
248
 
242
  $destination[ 'country' ] = $origin[ 'country' ];
243
  }
244
 
245
+ $destination_normalized = ( bool ) get_post_meta( $order->id, '_wc_connect_destination_normalized', true );
246
 
247
  $form_data = compact( 'is_packed', 'selected_packages', 'all_packages', 'flat_rate_groups', 'origin', 'destination', 'destination_normalized' );
248
 
classes/class-wc-connect-shipping-method.php CHANGED
@@ -317,6 +317,11 @@ if ( ! class_exists( 'WC_Connect_Shipping_Method' ) ) {
317
  $instances = $response_body->rates;
318
 
319
  foreach ( (array) $instances as $instance ) {
 
 
 
 
 
320
  if ( ! property_exists( $instance, 'rates' ) ) {
321
  continue;
322
  }
@@ -366,10 +371,11 @@ if ( ! class_exists( 'WC_Connect_Shipping_Method' ) ) {
366
 
367
  if ( 0 === count( $this->rates ) ) {
368
  $this->add_fallback_rate( $service_settings );
 
 
369
  }
370
 
371
  $this->update_last_rate_request_timestamp();
372
- $this->set_last_request_failed( 0 );
373
  }
374
 
375
  public function update_last_rate_request_timestamp() {
317
  $instances = $response_body->rates;
318
 
319
  foreach ( (array) $instances as $instance ) {
320
+ if ( property_exists( $instance, 'error' ) ) {
321
+ $this->error( $instance->error, __FUNCTION__ );
322
+ $this->set_last_request_failed();
323
+ }
324
+
325
  if ( ! property_exists( $instance, 'rates' ) ) {
326
  continue;
327
  }
371
 
372
  if ( 0 === count( $this->rates ) ) {
373
  $this->add_fallback_rate( $service_settings );
374
+ } else {
375
+ $this->set_last_request_failed( 0 );
376
  }
377
 
378
  $this->update_last_rate_request_timestamp();
 
379
  }
380
 
381
  public function update_last_rate_request_timestamp() {
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: automattic, woothemes, allendav, kellychoffman, jkudish, jeffstiel
3
  Tags: canada-post, shipping, stamps, usps, woocommerce
4
  Requires at least: 4.6
5
  Tested up to: 4.7.2
6
- Stable tag: 1.3.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -79,6 +79,10 @@ The source code is freely available [in GitHub](https://github.com/Automattic/wo
79
 
80
  == Changelog ==
81
 
 
 
 
 
82
  = 1.3.1 =
83
  * Fix compatibility bug with `mod_security`
84
  * Update shipping address on order when corrected by API
3
  Tags: canada-post, shipping, stamps, usps, woocommerce
4
  Requires at least: 4.6
5
  Tested up to: 4.7.2
6
+ Stable tag: 1.3.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
79
 
80
  == Changelog ==
81
 
82
+ = 1.3.2 =
83
+ * Hide destination address normalized order meta
84
+ * Log rate retrieval failures as errors with admin notice
85
+
86
  = 1.3.1 =
87
  * Fix compatibility bug with `mod_security`
88
  * Update shipping address on order when corrected by API
woocommerce-services.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: WooCommerce Services: Hosted services for WooCommerce, including free real-time USPS and Canada Post rates and discounted USPS shipping labels.
6
  * Author: Automattic
7
  * Author URI: http://woocommerce.com/
8
- * Version: 1.3.1
9
  *
10
  * Copyright (c) 2017 Automattic
11
  *
@@ -858,7 +858,7 @@ if ( ! class_exists( 'WC_Connect_Loader' ) ) {
858
  }
859
 
860
  function hide_wc_connect_order_meta_data( $protected, $meta_key, $meta_type ) {
861
- if ( 'wc_connect_labels' === $meta_key ) {
862
  $protected = true;
863
  }
864
 
5
  * Description: WooCommerce Services: Hosted services for WooCommerce, including free real-time USPS and Canada Post rates and discounted USPS shipping labels.
6
  * Author: Automattic
7
  * Author URI: http://woocommerce.com/
8
+ * Version: 1.3.2
9
  *
10
  * Copyright (c) 2017 Automattic
11
  *
858
  }
859
 
860
  function hide_wc_connect_order_meta_data( $protected, $meta_key, $meta_type ) {
861
+ if ( in_array( $meta_key, array( 'wc_connect_labels', 'wc_connect_destination_normalized' ) ) ) {
862
  $protected = true;
863
  }
864